EGL Unit (EUnit) is a testing framework provided with EDT to develop test variations, generate driver programs, and validate the runtime results. You develop your tests once in EGL and execute them on all desired platforms using EDT generators, your extensions, and/or your own generators. The driver program is convenient to produce, simple to run, and the pretty results easy to analyze. Once you’ve built a set of test variations that validates the core logic of your application, the framework allows you to quickly assert the quality of your foundation.
For step-by-step instructions on how to write, generate, execute, and review test cases, see the EUnit wiki page. Here’s a sample EUnit test library to illustrate the simplicity and power of the framework. This statusTest library has five test variations and displays the possible test results.
For step-by-step instructions on how to write, generate, execute, and review test cases, see the EUnit wiki page. Here’s a sample EUnit test library to illustrate the simplicity and power of the framework. This statusTest library has five test variations and displays the possible test results.
package framework;
// basic EUnit test library for testcase status
library statusTests
function testStatusPassed(){@Test}
LogResult.assertTrue1(100 > 50 );
end
function testStatusPassed02(){@Test}
actual string = "restraint";
expect string = "restraint";
LogResult.assertStringEqual1(actual, expect);
end
function testStatusFailed(){@Test}
success boolean = 100 < 50;
LogResult.assertTrue("Testing fail condition", success );
end
function testStatusError(){@Test}
stuff int[] {1,2,3,4};
actual int = stuff[13];
LogResult.assertBigIntEqual1(3, actual);
end
function testStatusSkipped() {@Test}
LogResult.logStdOut("Some info about the defect");
LogResult.skipped("Bugzilla xxxx. Compile problem.");
End
end
A test variation needs to include the test annotation {@Test} and use one of the LogResults assert functions. Using content assist is a great away to check out the available assertion functions. To ensure your foundation, you want your test variations to be used frequently and interpreted by anyone. The skipped function denotes a variation that has a known issue and logStdOut allows for additional information to be included. For the prettiest view of the results, you will need Business Intelligence and Reporting Tools (BIRT). Here’s the Statistics Chart:
This chart provides a quick color-coded summary count of passing and non-passing test cases for all the test libraries exercised by the driver program. For more detailed information, you can open the individual report (.etr) for each library. Here’s the detailed report for the statusTest library:
Framework.statusTests
Reason: test case count: 5
passed: 2
failed: 1
error: 1
skipped: 1
first test case with error: statusTests::testStatusFailed
msg:
statusTests::testStatusPassed: OK
statusTests::testStatusPassed02: OK
statusTests::testStatusFailed: FAILED - Testing fail condition
statusTests::testStatusError: ERROR - uncaught exception for: statusTests::testStatusError
=> EGL0010E: List index 12 is out of bounds. The list's size is 4.
Some info about the defect
statusTests::testStatusSkipped: SKIPPED - Bugzilla xxxx. Compile problem.
The file provides a convenience link to the associated EGL library in case the test case needs to be reviewed or altered. The file contains the totals by status (passed, failed, etc.), indicates the first failing test case by identifying the function name. The msg section provides detailed information for each test variation. It is common for a developer to run the tests, save the result root, apply code changes, rerun the tests, and compare the results files to ensure the expected core behavior.
Utilizing the EUnit test framework will help you ensure the solid foundation of your application. You just need to evolve the test suite along side your application.
The EUnit framework can be used to automate your testing efforts. Please post any features you’d like to see in EUnit, as we hope to add more to this useful tool.
Utilizing the EUnit test framework will help you ensure the solid foundation of your application. You just need to evolve the test suite along side your application.
The EUnit framework can be used to automate your testing efforts. Please post any features you’d like to see in EUnit, as we hope to add more to this useful tool.
Kathy
No comments:
Post a Comment