【问题标题】:Intern functional testing: skip a suite/test实习生功能测试:跳过套件/测试
【发布时间】:2016-02-11 06:45:44
【问题描述】:

我正在使用 Intern/Leadfoot 编写一些功能测试。这些测试是端到端测试(也称为故事),它们之间存在某种数据依赖关系。我的意思是,如果之前的测试(test1)没有成功完成,那么测试(即 test2)将会失败。因此,为了避免运行肯定会失败的测试,我想跳过它们(或其中的一部分)。因此,我想知道是否有办法实现这一目标。

考虑到所有的 test.js 文件都如下所示:

define([
    "require",
    "intern", 
    "intern!object",
    "../../support/executor/executor"],
    function(require, intern, registerSuite, Executor) {

    var executor;
    var steps = [

        // set of actions, 
        // like login, click this button,
        // then assert that ....
    ];

    registerSuite(function() {
        return {
            setup: function() {
                executor = new Executor(this.remote, steps.slice(0));
            },

            "Test 1": function() {
                return executor.run();
            },
        };
    });
});

这意味着每个 js 文件都是一个只包含一个测试的套件。换句话说,就像我想跳过所有剩余的套件,如果之前的套件失败了。

【问题讨论】:

    标签: javascript intern


    【解决方案1】:

    Intern 文档指定了可用于单元测试 (https://theintern.io/docs.html#Intern/4/docs/docs%2Fwriting_tests.md/skipping-tests-at-runtime) 的 this.skip 方法,该方法也适用于功能/e2e 测试。

    "skipped test":function(){
        this.skip('skipping this');
    }
    

    他们还通过配置 (https://theintern.io/docs.html#Intern/4/docs/docs%2Fwriting_tests.md/skipping-tests-at-runtime) 指定了一个 grep-regex 选项来跳过测试。

    【讨论】:

      猜你喜欢
      • 2014-05-21
      • 2015-12-30
      • 2015-10-13
      • 1970-01-01
      • 1970-01-01
      • 2015-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多