3rabanchi
3rabanchi

Reputation: 1

Setting the launch name manually in ReportPortal, Java Cucumber

I am using Jenkins pipeline to run the tests in parallel, the problem appears when the tests are sent to ReportPortal, they are all in separate launches, what i am trying to do is to set the launch name (the launch number to be precise) for tests manually so they would all be in one launch.

I have looked here for answers but only found some for NUnit and TestNG (which doesn't help me since i am having separate instances of the program). I am using Java main class to run each test in the pipeline, i read that i can set the launch name as an environment variable. Sadly i couldn't find any information how the implementation of it looks like. My question is, is it even possible to set the launch name without TestNG, if it is possible with environment variable how should i use the variable in the runner method to enforce the launch name?

 java -Dmaven.clean.skip=true -Dbrowser=firefox -Dos=linux -jar -Drun.tags=@CreateEntity target/standalone/web-tests.jar

This is my setup for each test (the run tag changes obviously), the glue for cucumber and plugin for the reportportal are in the runner method.

Upvotes: 0

Views: 4209

Answers (1)

Dmitriy Gumeniuk
Dmitriy Gumeniuk

Reputation: 420

TestNG is not mandatory for it. Here you can find JVM-based integration configs https://reportportal.io/docs/JVM-based-clients-configuration Which means, that if you use CucumberJVM (which has jUnit under the hood), you can use any related parameter.

To specify the name of launch, you can set it in reportportal.properties file or via the command line, as -Drp.launch=zzz

But it will not resolve the issue for multi-threads. In order to have all parallel threads reported into 1 launch, you can make it in 2 ways:

  1. Share launchID across threads. Which means that you can start launch at ReportPortal (as a part of you test runner or as a Jenkins pre-step + cUrl request). Receive launchID and share it with other threads/runners. Runners will use this id to post data, instead of creation of new launch for each thread. At the end make post-step to finish the launch.
  2. Merge launches via UI or API. Once all executions completed, you can merge them via UI. OR you can collect launchIDs during parallel sessions, and after all execution completion, just run API call to merge launches.

Than is relevant for ReportPortal v1-v4.

For the version 5+ of ReportPortal we plan to minimize this effort via Re-Run feature. https://github.com/reportportal/reportportal/issues/363

Test runners will share launchID by default via file on local storage. And if any other parallel thread will start in this environment, then launchID will be used for reporting automatically.

It still do not affect the case, if you have parallel executions, started in parallel mode at multiply VMs, but we will try to address this case as well.

Upvotes: 2

Related Questions