Open sergiuciudin opened 6 years ago
Yes, but not easily - it would involve some custom code and custom build scripting.
@wakaleo thank you for the fast reply :)
Can you share please the idea?
i have tried something like this but without success
Could you provide an example or some guidelines on how to run the tests with serenity from a *.jar file?
It really isn't trivial - I implemented something like this for a client a few years back for pure JUnit and it requires a fairly deep knowledge of JUnit and Serenity internals. I wouldn't know for JBehave.
And what about Cucumber-JVM ?
Hello, any details on how to do this? It's becoming more and more necessary apparently, to the point where we're forced to drop the framework solely because it cannot be done. A shame, really.
What problem are you trying to solve?
Ideally, having the ability to run individual tests from a packaged jar.
And what will this allow you to do? Test suites are typically run as part of a build process, so creating an executable jar from a Java project that includes both the tests and the application code, and a runner, really isn't simple. It's not Serenity, it's the whole Java development approach.
It would be just the packaged serenity project, not the application code as well. This way tests can be ran in parallel on AWS for example, or any number of other variations. The setup demands that the tests are ran in the deploy phase.
You could do this by putting all the tests in src/main/java and creating a main() method that triggers the JUnit runner classes. But wouldn't it be easier just to use Docker?
Could be, I'll give it a try. Thank you for your answer.
@wakaleo Got it to work, only problem: I don't get an index.html in the results, probably because the step that's usually done by serenity:aggregate is missing. Could you tell me how to run that directly in my main()?
Hello @vulkman can you please tell me how you got it working ? I currently use the maven-assembly-plugin and an assembly.xml to create that jar file. However running it locally and in Jenkins gives me nullpointerexceptions. It seems it can't see Serenity in the jar file.
Is there a way to run tests from main?