Skip to content

Reports not being generated when running from .jar file #238

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

Closed
pedrofg opened this issue Mar 3, 2020 · 7 comments
Closed

Reports not being generated when running from .jar file #238

pedrofg opened this issue Mar 3, 2020 · 7 comments
Labels

Comments

@pedrofg
Copy link

pedrofg commented Mar 3, 2020

Hi all, I have a cucumber project where I place my java classes under src/main instead of src/test and the reason for that is because I need to run this project as an executable jar (Jenkins builds this jar using maven).
When I run it via 'java -jar' I am able to see the default reports from the Cucumber framework but not the ones from Cluecumber unless I specifically run the maven command 'mvn cluecumber-report:reporting' which I can't since I need to run via .jar file.
I can see that whenever I run via 'java -jar' I can see the json file created but not the report (html,css,js). Is there any way I can invoke this report to be created via Java later on?

Has anyone dealt with this before?

@bischoffdev
Copy link
Collaborator

Why can't you run it via Maven if you use Maven to build it anyways? The generated JSON files are not contained inside the jar, are they? Cluecumber only needs the JSON files, nothing else.

@bischoffdev bischoffdev self-assigned this Mar 3, 2020
@pedrofg
Copy link
Author

pedrofg commented Mar 3, 2020

Hi Benjamin, first thanks for asking my question. Those tests I am developing will run against the system working in fact and not mocking, in the server, there is no maven nor internet connection so I use maven just to build the jar but not to run the tests.

The JSON files are generated in the file system and not inside the jar file, this is working now, I can see the default report with the Html page. The Cluecumber generates the JSON file since it is done by the plugin defined in the runner class I believe but it does not generate the report (html...) which I believe is done by the maven plugin. I just need to call the Cluecumber to finish the generation after all the tests are executed. Any ideas?

@bischoffdev
Copy link
Collaborator

Cucumber generates the json files via the runner class plugin. In order to use Cluecumber reports, it has to be invoked via Maven after the tests have run. So if your Jenkins has Maven support, call mvn cluecumber-report:reporting and pass the json location and output directory via the according system properties. If it does not have Maven support (which does not sound like it since Jenkins builds the jar anyways), you can also have a docker container with Maven run the reporting afterwards.

@bischoffdev
Copy link
Collaborator

Closing this due to no further reaction.

@ThomasSun001
Copy link

I got the same question as @pedrofg has, well, I want to package an executable jar file, then it is potable which can run without jenkins and mvn at all, in a pc installed java, and I don't have maven and jenkins installed, then i run into this problem

@bischoffdev bischoffdev removed their assignment Aug 9, 2021
@brizuelalionel
Copy link

I also have the same issue as @pedrofg

How can I generate an HTML report using this plugin from a JAR file ?

I have to deliver a .jar file that runs Selenium tests and then generate an HTML report using this plugin. This .jar file could be executed using java -jar command anywhere on any machine even though Maven is not installed on it.

Is there any way to achieve this using Java code , cucumber cli api, etc ?

@bischoffdev
Copy link
Collaborator

This is strictly a Maven tool so it is not possible to invoke it in another way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants