2.5. Examining Tests

Click on the exec1 label to examine the failing test. QMTest will display information about the test. The most important information about the test is its test class. This test is an instance of the python.ExecTest class. The test class indicates what kind of test exec1 is. QMTest gives a brief description of the test class in the GUI; a python.ExecTest checks that a Python expression evaluates to true.

For more details about the test class, you can click on the Help link to the right of the description. QMTest will pop up a window that describes the test in more detail. In summary, a python.ExecTest executes some setup code. Then, a Python expression is evaluated. If the expression evaluates to true, the test passes; otherwise, it fails.

The setup code and the expression are the arguments to the test class. Every test class takes arguments; the arguments are what differentiate one instance of a test class from another. QMTest displays the arguments for the exec1 test in the GUI. In this case, the sequence of statements is simply the single statement x = 2, which assigns 2 to the variable x. The expression is x + x == 5, which compares x + x with 5. Since x is 2 in this case, this expression evaluates to false. That is why the test fails.

You can click on the Help link next to each argument to get more details about exactly what the argument is for.