question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allure plugin doesnt generate report when running parallel execution in jenkins

See original GitHub issue

I have trying to generate reports using allure plugin when running tests in parallel

When looking at the report output, I see nothing getting populated

Provide console output if related. Use --verbose mode for more details.

# paste output here

Provide test source code if related

exports.config = {
    tests: './specs/*_test.js',
    output: './output',
    helpers: {
        WebDriver: {
            url: "http://hub-cloud.browserstack.com/wd/hub",
            browser: "chrome",
            smartWait: 5000,
            restart: true,
            user: "username",
            key: "key",
            capabilities: {
                "os": "Windows",
                "os_version": "10",
                "browserName": "Chrome",
                "browser_version": "72.0",
                "project": "codecept-wdio-qa",
                "build": "Build1.0",
                "browserstack.local": true,
                "browserstack.debug": true
            },
            host: "hub-cloud.browserstack.com"
        }
    },
    plugins: {
        wdio: {
            enabled: true,
            services: ['selenium-standalone']
        },
        allure: {
            enabled: true
        }
    },
    multiple: {
        parallel: {
            // Splits tests into 2 chunks
            chunks: 2
        }
    },
    include: {
        I: './steps_file.js'
    },
    bootstrap: null,
    mocha: {},
    name: 'codeceptjs-e2espec-tests'
};

Jenkins allure report config

image

output as you see in jenkins image

Details

  • CodeceptJS version:
  • NodeJS Version:
  • Operating System: *WebDriverIO

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
GSasucommented, Jan 30, 2020

@auto-qa-git if you look in the screenshots that you posted, you can see your problem there but let me guide you through this:

  • Allure is a wonderful and most commonly used reporter out there. This doesn’t mean that it doesn’t have quirks.
  • One of the quirks is that the test results needs to be stored in a folder called ‘allure-results’. If this is not done, then allure will revert to storing the results in a temporary folder which you can also see in the screenshot you added of the allure serve command output.

Solution:

codecept.conf.js

allure plugin config:

    plugins: {
        allure: {
            enabled: true,
            outputDir: './output/allure/allure-results', // notice the path used here pointing to allure-results
        },

In your jenkins allure plugin config the path needs to be the same as above: “output/allure/allure-results”

I used a groovy file for my jenkins pipeline so here’s how my allure reports are generated:

    post {
        always {
            generateAllureReport(env.SUITE)
        }
        success {
            slackSend channel: env.NOTIFICATIONS_CHANNEL ?: '#some-slack-channel',
                      color: 'good',
                      message: getNotificationMessage('Success')
        }
        failure {
            slackSend channel: env.NOTIFICATIONS_CHANNEL ?: '#some-slack-channel',
                      color: 'danger',
                      message: getNotificationMessage('Failed')
        }
    }
}

def getNotificationMessage(buildStatus) {
    return "${env.JOB_NAME} - #${env.BUILD_NUMBER} ${buildStatus} after " +
        "${currentBuild.durationString.replace(' and counting', '')} (<${env.RUN_DISPLAY_URL}|Open>)"
}

def generateAllureReport(suite) {
    if(suite) {
        return script {
                    allure([
                        includeProperties: false,
                        jdk: '',
                        properties: [],
                        reportBuildPolicy: 'ALWAYS',
                        results: [[path: 'output/allure/allure-results']]
                    ])
                }
    }
}

Try this out and let me know if you need more help with this.

0reactions
auto-qa-gitcommented, Jan 31, 2020

@GSasu Hi, thank you so much for your explanation. Earlier I tried this and it worked: image I am using allure on local. No Jenkins at the moment. However, when I change to outputDir: ‘./output/allure/allure-results’ I am having the same issue as before. It is a faulty report (showing 0 Test Cases etc… even though several test cases did run). And I still see this line in the console: image Is it only in codecept.conf.js that I have to specify the directory? And again - I am running my tests and using allure on local. I would go with what’s working now but I am having another problem which might be related: The issue that I am having is that when I run the test with parallel execution on say chrome and firefox, I get the results of only one. I do not get the report showing all test case results with the browser for each. I am aiming to have a report similar to this: image

Could you help with this please? Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allure plugin doesnt generate report when running parallel ...
I have trying to generate reports using allure plugin when running tests in parallel When looking at the report output, I see nothing ......
Read more >
Allure reports in parallel test pipeline in Jenkins - Stack Overflow
i understand that allure cannot split parallel execution to generate two different reports. maybe at least allure is able to record results of ......
Read more >
allure-framework/allure-core - Gitter
The report generate successfully for parallel execution. When I use this for cross browser testing, it will only display one set of browser...
Read more >
xUnit - Jenkins Plugins
This plugin makes it possible to record xUnit test reports. ... Execute your testing tools manually or as a step of your build...
Read more >
Publishers — Jenkins Job Builder 3.12.1.dev9 documentation
Example: publishers: - aggregate-tests: include-failed-builds: true. allure ¶. Publish Allure report for the build. Requires the Jenkins Allure Plugin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found