Creating a Unit Test Project

Test fixture files (and the test cases within them) can only be created in a unit test project.

  1. While in the Team Developer perspective, select File > New > Other.

    This opens the New dialog box.

  2. Expand Micro Focus COBOL, and then click COBOL Unit Test Project.
  3. Click Next.

    This opens the New COBOL Unit Test Project dialog box.

  4. In the Project name field, type TestAirportDemo.
  5. Click Finish.

    The project is created, and displayed in the tree view.

    Before you add a test fixture file to the project and run it (during which, a COBOL Unit Test run configuration is created), you will add the environment variable that enables the test run to locate the data file used by the unit tests. (If you do not create the variable before the run configuration is created, you must manually configure it from the Environment tab within the run configuration details once the run configuration has been created.)

  6. Right-click the TestAirportDemo project, and then click Properties.

    This opens the Properties for TestAirportDemo dialog box.

  7. Click Micro Focus > Run-time Configuration > Environment Variables.
  8. On the Environment Variables page, click Add.

    This opens the Add Variable dialog box.

  9. In the Variable field, type dd_airports.
  10. In the Value field, type ..\..\AirportDemo\airports.dat.
  11. Click OK.
  12. Click Apply and Close.

    Test cases within this unit test project will now use the original data file used by the AirportDemo application.

Next you must add the test fixture file that will contain your test cases.