Genetec / azure-devops-extension-publishtestresultscreenshot

Azure DevOps extension used in CI pipeline to upload screenshot in test results report.
https://marketplace.visualstudio.com/items?itemName=Genetec.publish-test-result-screenshot
Apache License 2.0
10 stars 6 forks source link

Support Release #7

Closed DigiBanks99 closed 4 months ago

DigiBanks99 commented 3 years ago

Support deploying screenshots captured for tests run during the release phase.

DigiBanks99 commented 3 years ago

@eric-labelle Could I request a review please?

eric-labelle commented 3 years ago

Sorry for the delays @DigiBanks99 . I'll try to work on it on this Friday afternoon. Thank you for your PR and patience. Much appreciated.

eric-labelle commented 3 years ago

Hey @DigiBanks99 really sorry for the huge delay, I was assigned to other projects and had a hard time getting back on this. I managed to have a valid setup to test your PR, would you mind explaining a couple of things to me first? I tried it, but it does not work for me on a Release Pipeline it ends up with the following log

Task completed. Published 0/1 screenshots 2021-07-15T19:22:00.2823260Z (node:1772) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: name not supplied

Regarding the new parameter releaseContext I dont believe this is necessary, and the values are not actually valid from what I've seen on the class It should be one of the following

That's why I sent undefined when calling getTestResultsByBuild so you could try that.

Also, was there a reason why you added a checkbox to specify if you are in a Release pipeline, but you still try to execute the code from a build pipeline. I'm sure there must be a way, either with predefined variables or the uri to know if we are in a release or a build pipeline and act accordingly i.e. - pseudo-code

if ( isBuildPipeline ) {
    await testApi.getTestResultsByBuild(project, +(tl.getVariable("Build.BuildId") ?? 0), undefined, [TestOutcome.Failed])
            .then(async failedTests =>  uploadScreenshots(failedTests))
            .catch(err => tl.setResult(tl.TaskResult.Failed, err.message))
} else {
    await testApi.getTestResultsByRelease(project, getVariableAsNumber("Release.ReleaseId"), getVariableAsNumberOrUndefined("Release.EnvironmentId"), undefined, [TestOutcome.Failed])
        .then(async failedTests =>  uploadScreenshots(failedTests))
        .catch(err => tl.setResult(tl.TaskResult.Failed, err.message));
}

One last thing, what was the need behind the parametrized separator? This seems unrelated to this PR.

Thanks

qakarp commented 1 year ago

merge it guys, we need it :)

kjgen commented 4 months ago

Closing pull requests because the extension is being deprecated and will no longer be maintained. An alternative solution is to use the Publish Test Result task which now supports file attachments.