cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.04k stars 1.09k forks source link

getting the report after running cucumber programmatically #2381

Closed OhadR closed 6 months ago

OhadR commented 6 months ago

hi,

I am running cucumber programmatically this way:

i have a "loader" function:

    let support;
    const resolvedConfiguration = await loadConfiguration();
    let runConfiguration : IRunConfiguration= resolvedConfiguration.runConfiguration;

and the invocation:

    let result: IRunResult;
    if(!support)   //global variable
        result = await runCucumber(runConfiguration);     
    else
        result = await runCucumber({...runConfiguration, support});

    const success = result.success;
    support = result.support;

my question: is it possible to get the report that is produced after the run? currently, all I get is true/false. but in the logs there is a report, like "https://reports.cucumber.io/reports/6f774943-6d51-44cf-942c-23XXXX" - what is the best practice to fetch it?

thanks in advance!

relevant: #1711 cucumber version: 8,1,2

davidjgoss commented 6 months ago

Thanks for raising @OhadR. Currently there's no easy way to get a hold of that URL, unless you capture your stderr and parse it out of there.

We have an issue #1797 for this already, so I'll close this to avoid duplication, and you can watch that one for updates.

Unfortunately the reports service is currently in a sort of limbo state while we uncouple from our previous corporate backer, so this is unlikely to move for a while. In the meantime I'd suggest using the built-in HTML formatter if it's practical for you. https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#html