-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JUnit-style reporter for Serenity/JS #346
Comments
Hey @igTkachov - I'm not that familiar with Azure, but do I understand correctly that you'd like Serenity/JS to produce a test report in an xUnit format so that it can be imported into another tool? Is that right? |
Hey @jan-molak |
I see; A better approach would be to implement a custom JUnit reporter (or a But to address your immediate challenge. What you'd need to do is to implement a If you're using 1.x have a look at the If you're on version 2, have a look at the The main difference between the v1 and v2 implementations of |
I'm not expert in js, but I want to try it. |
Yup! Got the same issue :) I need it for circleci.com . Alternatively, I would be happy with a cucumber compatible JSON file. |
@igTkachov Can I provide a workaround? cucumber-junit-convert can be your friend in this case: npm i --save-dev cucumber-junit-convert in your protractor conf, add format options to emit cucumber results in a JSON format to a specific file, like: cucumberOpts: {
format: ['pretty', 'json:target/cucumber_report.json'],
'format-options': '{"colorsEnabled": true }',
require: [`${process.cwd()}/transform/**/*.js`],
compiler: 'ts:ts-node/register'
} Then create a JS file which will convert this JSON report to JUNIT style report. Let's say, the file name is jenkins.report.js const cucumberJunitConvert = require('cucumber-junit-convert');
const options = {
inputJsonFile: 'target/cucumber_report.json',
outputXmlFile: 'target/cucumber_report.xml'
};
cucumberJunitConvert.convert(options); You can add the conversion process to the serenity report step in your package.json like: "report": "serenity run --cacheDir ./lib/serenity-cli && node ./jenkins.report.js", Now, every time you produce Serenity HTML reports, it will generate a JUNIT style report as well in specified folder. |
@abhinaba1080 I've created my local convertor for Azure report. But your convertor should work, because Azure can parse cucumber report in xml format. |
@abhinaba1080 what is in your /transform/ folder? And my cucumber_report.json file is just empty? i.e. 0 bytes. [test:execute] When the user logs in with correct credentials |
Hi @andreasmarkussen , The transform folder is where I keep all of the JS files. Can you share your protractor.conf file? |
OK - got it working now. There are two learnings I would like to highlight: I fixed my steps code, that was not implemented as it should. The folder location must be created e.g. reports/cucumber must exist before the reporter can write to the file. Here is my protractor.conf.js
|
@jan-molak : Hello,
I create another artifact like:
Then I do a broadcast like this:
Report is not created, I believe because ArtifactArchiver has a check for:
Any help on how to proceed is appreciated. |
@aksbenz - If you'd like to raise a PR we could work on it together? |
@jan-molak : Not experienced with open source projects. I am not sure how to go about creating another junit reporter package in serenity. My Junit reporter looks like this: Created a copy of ArtifactArchiver with XMLData: Thanks. |
Please check pr for initial steps towards junit reporter. Thanks. |
Note to self: Looks like Gitlab supports attaching screenshots to JUnit reports. Same with Jenkins. |
Hey folks! Looks like quite a few people have asked for this functionality. I did have a closer look at what is required to make it happen and it feels like it would be a good opportunity to improve how Serenity/JS artifacts work in general. I'm planning to make the mechanism more flexible to support not just JUnit, but also other custom report and artifact types in the future. If you think that it's a worthwhile effort, and you too would like to see this feature added, please consider sponsoring this goal at https://github.com/sponsors/serenity-js |
…ing and reading files This is an enabler to support reading and writing files other than screenshots and JSON test reports using the FileSystem abstraction Related tickets: re #346
Please tell
Have we hook for convert serenity report to some xUnit reports for import to Azure?
The text was updated successfully, but these errors were encountered: