简体   繁体   中英

Protractor - How to exclude spec file in the config file?

Suppose I have 10 spec files all are named *********.test.js , I want to run my tests on all 9 files except the file Idontwantyou.test.js .

Currently I am finding my spec files in my config.file with:

specs: ['*.test.js'] - this will run all 10 files.

How do I make it run all the 9 test files but skip the Idontwantyou.test.js ?

You can exclude the spec's by adding them in the exclude tag in you conf.js file. You can also add patterns to exclude many test scripts with similar names. Here's how to do it -

exclude: ['Idontwantyou.test.js'],

More info can be found here . Hope this helps. If that link is broken, search theconfig file for "exclude".

As Grish suggested you can use exclude . As per the comment of Darkbound the exact location is given below .Modify the config.js as per below .

In here in specs: I mentioned the src/com/sam/scriptjs/ExcelTest.js but since I specifically excluded it , it won;t get picked .

exports.config = {
  framework: 'jasmine',

    multiCapabilities: [{
          'browserName': 'firefox'
        }, {
          'browserName': 'chrome'
        }],
  seleniumAddress: 'http://localhost:4444/wd/hub',
  exclude: ['src/com/sam/scriptjs/winstonlogs.spec.js','src/com/sam/scriptjs/ExcelTest.js'],
  specs: ['src/com/sam/scriptjs/nonangularstackscript.spec.js','src/com/sam/scriptjs/radiobutton.spec.js','src/com/sam/scriptjs/ExcelTest.js']


}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM