Unit testing

Creating unit tests

For creating unit test you need:

  • create class in TASKNUMBER_TESTDESCRIPTION.py (for example test_MSK_111_bug_with_encoding.py) file in www/ with unittest.TestCase ancestor with following method 

class SomethingTest(unittest.TestCase):

       def testSomething(self):

               self.assertTrue(testSomething)

 

  • add import of the SomethingTest's module into www/test_main.py
  • add line 

suite.addTests(unittest.TestLoader().loadTestsFromModule(your_file_name))

         before the following line 

unittest.TextTestRunner(verbosity=2).run(suite)

 

Running unit tests

Execute following command

www/run_tests.sh

http://docs.python.org/2/library/unittest.html