lakshaykaushik / PublishHTMLReport

Azdo Extension- Publish Jmeter Reports to Azure Devops
MIT License
34 stars 24 forks source link

Publish genericHTML folder #17

Closed ChromeQ closed 3 years ago

ChromeQ commented 3 years ago

I am trying to display the Istanbul code coverage for a JS project in your extension. The code coverage creates a folder with src files including css and js, and an index.html.

When adding the folder as the htmlPath to the extension I get this error:

##[error]Unable to process command '##vso[task.addattachment type=replacedhtml;name=content;]D:\a\1\s\TestProject\coverage' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
##[error]Value cannot be null. (Parameter 'Cannot upload task attachment file, attachment file location is not specified or attachment file not exist on disk')
Finishing: Publish Code Coverage

Here is the task:

- task: publishhtmlreport@1
  displayName: Publish Code Coverage
  inputs:
    htmlType: 'genericHTML'
    htmlPath: '$(Agent.BuildDirectory)\s\$(applicationRepository)\coverage'

Will it be possible to upload all files in that directory and then assume an index.html file as any server would?

ChromeQ commented 3 years ago

I then tried adding index.html to the end of the htmlPath, and it did indeed upload that and I could see the index.html in the Published HTML tab. Unfortunately, there are no css files included or js, I know you have the docs to describe using appendChild for scrips etc, but it seems a high barrier for entry since I do not have control of the index.html produced by the code coverage report.

I may be over simplifying this, but can't this extension simply act as a simple http server or display the iframe of whatever folder of html and associated files? I believe that would make this extension easy to use and very popular.

acampbel commented 3 years ago

+1, this would be great.....generic folder would then work just like the JMeter report for any other report. Most useful reports have more than just the html file.

lakshaykaushik commented 3 years ago

Hi folks, apologies for late reply. Unfortunately the best way (uploading all files and rendering index.html like a server) cannot be achieved in azure devops as per what i know. This was also my preferred choice and since there is currently no way to do this, i chose this route (Supporting jmeter and documenting how to do it for others tools). You can contribute to this extension and support your choice of tool if you thing will be re-usable.

johnqa commented 3 years ago

For me a workaround would be to put the folder in a shared folder and have a web server to serve them. Unfortunately I don't know a good plugin to do that, The only one I know is allure plugin.

lakshaykaushik commented 3 years ago

yeah, there are multiple issues with that approach. Most significant one is how do you make sure only azure AD authenticated users can fetch the report and it's not publicly on the internet for anyone else to see. Better zip the folder, publish as an artefact and download it to view the files.