To debug the test case, you must use the Debug option within the
Micro Focus Unit Testing window.
-
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.
-
Set a breakpoint on the line that starts:
string "Incorrect distance in kilometers returned...
-
In the
Micro Focus Unit Testing window, right-click
MFUT_TESTAIRCODE, then select
Debug Test.
The debug engine starts, and test execution stops at the breakpoint.
-
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...
-
Press
F5 to execute the rest of the test case.