Menu

Validate_unit_tests

Robert Kofler

Introduction - unit tests

To ensure proper execution of our DSL we implemented unit tests. Unit tests enable automated testing of the code. The code is treated as a black box where the input and the expected output is provided. A unit test just checks wheter the observed output agrees with the expected output.

Following an example of a unit test:

def test_singledeletion(self):
          tt=self.tt
          tt.addDefinition("d=a[4..6]")
          self.assertEqual(tt.getTESequence("a").sequence,"AAATTTAAA")
          self.assertEqual(tt.getTESequence("d").sequence,"AAAAAA")

The sequence a is AAATTTAAA. The unit test ensure that deletion of the intermediate three bases (a[4..6]) results in the sequence AAAAAA

Run unit tests

To run the Unit-tests and thus ensure proper execution of our DSL use the following commands:

cd unittests
python test-TEdefinitionlanguage.py

you should get something like this:

Ran 33 tests in 0.007s

OK

This indicates that the DSL is executed properly


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.