Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

3) For running unit test need to go in terminal and run tox from teminallook for main directory of the project after that run the command below.

    command: tox

4) On how can we write a test case in Unit test:

   First things need to decide which unit we would like to start with below is an example. 

 below is the code to test:

Image Added

below is the setup first need to test a testcase:

for setup need to import dependency and and class/method that need to be tested

it also differs what is the return value or what is that we want to test. In this case we need to check if it has all the properties when we initiate an instance of a complex class so that we can populate it with further relevant data. In the code blow you might see setup method which is used to set the values before starting any testcase. The setUp() and tearDown() methods allow you to define instructions that will be executed before and after each test method. The  unittest.main() provides a command-line interface to the test script.

Image Added


5) After running it you will see the results as below:

...