Skip to content

How to change test name when using dataprovider? #3376

Closed Answered by Yasuslik
Yasuslik asked this question in Q&A
Discussion options

You must be logged in to vote

I solved problem

If anyone comes across this problem you need create custom plugin like this:

plugin/Listener.js

const event = require('codeceptjs').event;

module.exports = function() {
    event.dispatcher.on(event.test.before, function (test) {
        test.title = test.inject.current.TestName;
    });
}

In codecept.conf.ts enable custom plugin

  plugins: {
    retryFailedStep: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    },
    Listener: {
      require: "./plugin/Listener.js",
      enabled: true
    }
  }

in data provider i have next:

export const data = [
    {
        TestName: 'case7 - empty parameter',
        fixture_data:  {},
        provider_data

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Yasuslik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant