【问题标题】:How to run a specific test case from a test suite using InternIO如何使用 InternIO 从测试套件运行特定的测试用例
【发布时间】:2015-11-27 05:51:33
【问题描述】:

目前,我有一些测试套件。为了避免运行整个测试套件 - 我怎样才能从一个套件中只运行一个测试用例。我目前的解决方法是注释掉我不想要的测试用例。

我的 intern.js 文件:

define({
 environments: [
    { browserName: 'chrome'},
  ],


  useSauceConnect: false,

  //functionalSuites: ['tests/projects/projectA/main.js'],

  tunnel: 'NullTunnel',

  excludeInstrumentation: /./
});

以下是我的 main.js 文件:

    define([
        'intern',
        'intern!object',
        'intern/chai!assert'        
    ],
    function (intern, registerSuite, assert) {



    registerSuite(function () {

        var someLib;


        return {
            setup: function () {

            },

            'TC001 - Functionality 1': function () {

            },

            'TC002 -  Functionality 2': function() {


            },

            'TC003 - Functionality 3': function() {


            },


        };
    });
});

我正在使用命令行运行它:运行 - 我发出以下命令:

$ node_modules/.bin/intern-runner config=tests/intern     functionalSuites=tests/projects/projectA/main.js

有没有办法只运行“TC001 - 功能 1”和其他选定的测试用例而不注释掉套件中的其他测试用例?

【问题讨论】:

    标签: testing automated-tests functional-testing intern


    【解决方案1】:

    您可以使用grep command line optiongrep 选项指定一个正则表达式,用于过滤测试 ID(运行匹配的测试 ID),在指定将运行哪些测试时为您提供很大的灵活性。最简单的是,您可以只提供一个短字符串,然后 Intern 将使用包含该字符串的 ID 运行任何测试:

    $ node_modules/.bin/intern-runner config=tests/intern  functionalSuites=tests/projects/projectA/main grep=TC001
    

    【讨论】:

      猜你喜欢
      • 2014-09-20
      • 1970-01-01
      • 1970-01-01
      • 2011-12-06
      • 2015-01-31
      • 1970-01-01
      • 1970-01-01
      • 2012-11-25
      相关资源
      最近更新 更多