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.

How to get thread number with parallel execution for Allure report timeline?

See original GitHub issue

What are you trying to achieve?

I’m running tests in parallel with 4 chunks and write reports to Allure. I want to see tests from each chunk displayed in a separate timeline. If I manually add a “thread” label to each suite or test (in the XML) I can split the test results into multiple timelines. parallel timelines

What do you get instead?

By default in the Allure report all tests are displayed in one timeline. single timeline

I can add labels to test cases like

const allure = codeceptjs.container.plugins('allure');

Before(() => 
  allure.addLabel('thread', '...')
)

My question is - how can I get the chunk number in the test?

Details

  • CodeceptJS version: 2.3.0
  • NodeJS Version: 10.16.3
  • Operating System: Windows 10
  • Configuration file:
exports.config = {
  ...
  mocha: {
    reporterOptions: {
      reportDir: "./test/report",
      autoOpen: true,
    }
  },
  plugins: {
    allure: {
      enabled: true,
      outputDir: "./test/.output/allure-results"
    },
    stepByStepReport: {}
  },
  multiple: {
    parallel: {
      chunks: "4"
    }
  },
  bootstrap: false,
  teardown: null,
  hooks: [],
  tests: "./test/tests/ui/dashboard/*.js",
  timeout: 120000,
};

Running tests with

npx codeceptjs run-multiple parallel

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
theptyzacommented, Sep 24, 2019

@Naimadnap I’ve created an allureHelper

'use strict';

let Helper = codecept_helper;

class AllureHelper extends Helper {
    _before() {        
        let child = codeceptjs.config.get().mocha.child;
        // if there are child processes set thread label in Allure report to chunk number
        // child process name is like '1.parallel:chunk1:default'
        if(child) {
            const allure = codeceptjs.container.plugins('allure');
            allure.addLabel('thread', child.substring(0, child.indexOf('.')));
        }
    }
}

module.exports = AllureHelper;

and included it in codecept.conf.js

helpers: {
    Nightmare: {
      url: process.env.CODECEPT_URL || "http://localhost:3000",
      windowSize: "1920x1080",
      typeInterval: "-1"
    },
    allureHelper: {
      require: "./test/helpers/allureHelper.js",
    }
  },
1reaction
theptyzacommented, Aug 20, 2019

@xMutaGenx thanks! Your solution is even better since it gives the actual chunk number.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allure Framework
To generate your first report you will need to go through just a few simple steps: Downloading and installing Allure commandline application ...
Read more >
allure-framework/allure-core - Gitter
Hi all, I'm using webdriverIO to generate results. I have nested describes which causes Allure to generate a report with lots of suites...
Read more >
Allure Report Selenium and TestNG Tutorial
Step-3: Run the Test and Generate Allure Report​​ Now, it is time to generate the report! To generate a report, we should install...
Read more >
Allure Report - QA Automation Expert
The timeline tab visualizes retrospective test execution, allure adaptors collect precise timings of tests, and here on this tab, they are arranged accordingly ......
Read more >
Reports, Parallel Execution, And Rerun of failed testcases with ...
Hence, our framework also should have the same capability to create output or generate test execution reports. What are the various kinds of ......
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