I have the need to send reports from different OS and test runs to the same launch in the report portal. How this can be done?
Here is how it's accomplished on my project:
When the tests start, they see that there is launch id in app.config and don't create a new launch - they re-use the existing one. Also they don't close the launch once they are done.
[BeforeTestRun(Order = -30000)]
public static void BeforeTestRunPart()
{
ReportPortalAddin.BeforeRunStarted += ReportPortalAddin_BeforeRunStarted;
ReportPortalAddin.BeforeRunFinished += ReportPortalAddin_BeforeRunFinished;
}
public static void ReportPortalAddin_BeforeRunStarted(object sender, RunStartedEventArgs e)
{
var launchId = SettingsManager.CommonSettings.ReportPortalLaunchId;
if (launchId.IsNullOrEmpty() == false)
{
e.Canceled = true;
Bridge.Context.LaunchId = launchId;
}
}
public static void ReportPortalAddin_BeforeRunFinished(object sender, RunFinishedEventArgs e)
{
var launchId = SettingsManager.CommonSettings.ReportPortalLaunchId;
if (launchId.IsNullOrEmpty() == false)
{
e.Canceled = true;
}
}
When all tests are run, CI server closes the RP launch.