简体   繁体   English

量角器 - 如何在配置文件中排除规范文件?

[英]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 .假设我有 10 个规范文件都命名为*********.test.js ,我想对除文件Idontwantyou.test.js之外的所有 9 个文件运行我的测试。

Currently I am finding my spec files in my config.file with:目前我在我的config.file找到我的规范文件:

specs: ['*.test.js'] - this will run all 10 files. specs: ['*.test.js'] - 这将运行所有 10 个文件。

How do I make it run all the 9 test files but skip the Idontwantyou.test.js ?如何让它运行所有 9 个测试文件但跳过Idontwantyou.test.js

You can exclude the spec's by adding them in the exclude tag in you conf.js file.您可以通过将它们添加到 conf.js 文件的 exclude 标记中来exclude规范。 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 .正如 Grish 建议的那样,您可以使用 exclude 。 As per the comment of Darkbound the exact location is given below .Modify the config.js as per below .根据 Darkbound 的评论,下面给出了确切的位置。按照下面的内容修改 config.js。

In here in specs: I mentioned the src/com/sam/scriptjs/ExcelTest.js but since I specifically excluded it , it won;t get picked .在规格中:我提到了 src/com/sam/scriptjs/ExcelTest.js 但由于我特意排除了它,它不会被选中。

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']


}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 量角器在配置文件中定义规格 - Protractor Define Spec In Config File Protractor - 在规范 2 中读取在规范 1 中填充的 CSV 文件 - Protractor - read in spec 2 a CSV file populated in spec 1 量角器规格文件路径不起作用 - Protractor spec file path not working 规格文件未被 Protractor cucumber 框架识别 - Spec file not getting identified by Protractor cucumber framework 量角器黄瓜-无法匹配规格文件模式(列出2个功能) - Protractor Cucumber- Unable to match spec file pattern (listing 2 features) 我是否需要使用量角器初始化我的Spec文件中的页面对象? - Do I need to Initialize the page object in my Spec file with Protractor? Protractor:我可以在一个规范文件中有两个描述块吗? - Protractor : Can I have two describe block in one spec file? 如何配置 playwright-jest 以排除运行的测试套件(规范)文件? - How do I configure playwright-jest to exclude a Test Suite (spec) file for a run? 量角器无法找到配置文件:错误:找不到模块'/protractor/protractor.conf_sanity.js' - Protractor unable to find config file: Error: Cannot find module '/protractor/protractor.conf_sanity.js' 描述未定义,加上我的配置文件未在量角器上运行 - Describe is not defined plus my config file does not run on protractor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM