Search code examples
azureazure-devopsgatling

Gatling index.html report not loading properly in AZure Devops after publishing


Image of the Gatling index.html report not loading properly:

Click here for reference


Solution

  • I could reproduce the same issue when I publish the Index.html file in azure devops.

    enter image description here

    When I check the source code of the Index.html file, I notice that this file needs to call the style from the style and js folder.

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" type="image/x-icon" href="style/favicon.ico"/>
    <link href="style/style.css" rel="stylesheet" type="text/css" />
    <link href="style/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/gatling.js"></script>
    <script type="text/javascript" src="js/moment-2.24.0.min.js"></script>
    <script type="text/javascript" src="js/menu.js"></script>
    <script type="text/javascript" src="js/all_sessions.js"></script>
    <script type="text/javascript" src="js/stats.js"></script>
    <script type="text/javascript" src="js/highstock.js"></script>
    <script type="text/javascript" src="js/highcharts-more.js"></script>
    <script type="text/javascript" src="js/theme.js"></script>
    <script type="text/javascript" src="js/unpack.js"></script>
    <title>Gatling Stats - Global Information</title>
    </head>
    

    When you only publish the index.html page , it cannot find the referenced style, so this problem occurs.

    To view the correct content of the index.html, you need to publish the result as build artifacts in Azure Devops.

    steps:
    - task: Maven@3
      displayName: 'Maven pom.xml'
      inputs:
        goals: 'mvn gatling:test'
    
    - powershell: 'mvn gatling:test'
      workingDirectory: '$(build.sourcesdirectory)'
      displayName: 'PowerShell Script'
    
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'
      inputs:
        PathtoPublish: '$(Build.sourcesdirectory)/filepath'
    

    enter image description here

    Then you could download the artifacts to your local machine.

    enter image description here

    All in all, in azure devops, there is no method to load the referenced style in build tab(e.g. Published Html), so you can only download it locally for viewing.

    Update1:

    enter image description here