Test code
In Jest, you can include the RTM test case key in the test description:
test('RTM_TEST_KEY_AUT_5: Verify user login', async () => {
// Test code here
});
test('AUT-6: Verify user logout', async () => {
// Test code here
});
Test Result File (JUnit XML)
By configuring Jest to output test results in JUnit XML format, you can generate a report that includes the test names with the RTM keys:
<testsuites>
<testsuite name="Login Tests" tests="1" failures="0" errors="0" skipped="0" timestamp="2024-10-03T09:32:45.503Z" time="2.345">
<testcase classname="Login Tests" name="RTM_TEST_KEY_AUT_5: Verify user login" time="2.345"/>
<testcase classname="Logout Tests" name="AUT-6: Verify user logout" time="2.345"/>
</testsuite>
</testsuites>
To enable JUnit reporting in Jest, add the following configuration to your jest.config.js:
module.exports = {
// Other configuration options...
reporters: [
"default",
[ "jest-junit", {
outputDirectory: "./test-results",
outputName: "junit.xml",
}]
],
};
When the test results are imported into RTM, the system can parse the name attribute of each testcase element to extract the RTM Test Case key and link the execution accordingly.