I am linking Playwright tests with Xray props so that I can use Xray rest apis to send the executed automated test results to Xray.
I want to add some more test info like browser name, execution environment, etc to test case.
At present, I am adding testInfo annotation like this to Playwright test:
test('some test', async () => {
testInfo.annotations.push({ type: 'test_key', description: testKeyValue });
// my test body
});
I am not sure what are the string to define in `type` key here so that I can display testInfo like browser, environment, etc.
Also, is there any other better way to map testInfo prop for each test in Playwright? Like we are doing it for every test, would be better if that can be done once for all the tests.
Hi @Shiv Jirwankar ,
I hope you're doing well!
Xray can process test automation results using different test report formats.
One of the supported formats is JUnit XML; in this case, Xray can process it accordingly with the rules found in this documentation:
https://docs.getxray.app/display/XRAY/Taking+advantage+of+JUnit+XML+reports
Xray supports an enhanced JUnit XML that can process additional test-level properties, such as test_key. To be able to generate to process some user-defined annotations, and generate this enhanced JUnit XML report, you need to use a custom reporter for JUnit:
https://github.com/Xray-App/playwright-junit-reporter
Note that you cannot add random annotations.
Xray only processes a few specific ones, as described on the first link shared earlier.
To achieve your goal, you would probably need to provide that info either as a test run comment using the testrun_comment type, or use specific test run custom fields (you would need to create them before on Xray side) to embed that information; on the latter case, you would need to use a type such as "testrun_customfield:your_specific_field"
Hope it helps, best, Francisco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.