Previous Topic Next topic Print topic


Debugging the Failed Test

To debug the test case, you must use the Debug option within the Micro Focus Unit Testing window.
  1. Just as you would when debugging any other program, you need to set a breakpoint beforehand; if TestAIRCODE.cbl is not already displayed in the editor, open it from Solution Explorer.

    The test program is displayed in the editor.

  2. Set a breakpoint on the line that starts:
    string "Incorrect distance in kilometers returned...
  3. In the Micro Focus Unit Testing window, right-click TESTAIRCODE, then select Debug Test.

    The debug engine starts, and test execution stops at the breakpoint.

  4. Hover over the distance-km variable to see the distance between the two airports (Heathrow and Seattle). The distance has been calculated as 7,703 (which happens to be the correct distance), and so the code is executing as it should. It is also asserting a failure correctly, but that is because the wrong value was being tested for (it's testing for the distance in miles - 4,787), as you can see from the following line:
    if function numval(distance-km) not equal 4787...
  5. Press F5 to execute the rest of the test case.
Previous Topic Next topic Print topic