Allure Methods Called from eventListener Not Reflecting in the Report #2699
Replies: 1 comment
-
I want to clarify the problem I have - the currentTest in the Allure object is null for an unknown reason |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I installed allure-codeceptjs - 2.15.1 version & allure-commandline - 2.13.0 version
in project that using codeceptjs
I am calling various Allure methods from an eventListener to extend the test report with additional parameters, owner information, and a link to the test's execution URL. However, the data I attempt to add does not appear in the generated Allure report.
code snippet:
event.dispatcher.on(event.test.after, async (test) => { const email = I.getLoggedInEmail(); const url = await I.grabCurrentUrl(); const resTeam = await getTeamNameFromFeature(test.file); extendAllureReport(resTeam, test.file, email, url); });
extendAllureReport implemenration:
`export const extendAllureReport = (
resTeam: string,
testFile: string,
email: string,
url: string,
): void => {
try {
const finalTestFile: string = testFile.replace(ETestsPostfix.FAILED_TEST, ETestsPostfix.TEST);
} catch (error) {
output.error(
Failed to add responsible team, Test file path, url and user to report: ${error}
,);
}
};`
export const addAllureParameter = (fieldName: string, parameter: any): void => { try { allure = getAllureInstance(); console.log(
addAllureParameter - Allure parameter: ${parameter}); allure.parameter(fieldName, parameter); } catch (error) { output.error(
Failed to add Allure parameter: ${error}`);}
};
const getAllureInstance = () => {
if (!allure) {
allure = codeceptjs.container.plugins("allure");
console.log("Allure instance created.");
}
return allure;
};`
important fact:
if I call the extendAllureReport method from Scenario it works as expected.
few questions:
Any guidance or suggestions to resolve these issues would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions