Testing 如何使用InternIO从测试套件运行特定测试用例
目前,我有一些测试套件。为了避免运行整个测试套件,我如何从一个套件中只运行一个测试用例。我目前的解决方法是注释掉我不想要的测试用例 My intern.js文件:Testing 如何使用InternIO从测试套件运行特定测试用例,testing,automated-tests,functional-testing,intern,Testing,Automated Tests,Functional Testing,Intern,目前,我有一些测试套件。为了避免运行整个测试套件,我如何从一个套件中只运行一个测试用例。我目前的解决方法是注释掉我不想要的测试用例 My intern.js文件: define({ environments: [ { browserName: 'chrome'}, ], useSauceConnect: false, //functionalSuites: ['tests/projects/projectA/main.js'], tunnel: 'NullTun
define({
environments: [
{ browserName: 'chrome'},
],
useSauceConnect: false,
//functionalSuites: ['tests/projects/projectA/main.js'],
tunnel: 'NullTunnel',
excludeInstrumentation: /./
});
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() {
},
};
});
});
以下是我的main.js文件:
define({
environments: [
{ browserName: 'chrome'},
],
useSauceConnect: false,
//functionalSuites: ['tests/projects/projectA/main.js'],
tunnel: 'NullTunnel',
excludeInstrumentation: /./
});
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
是否有一种方法可以运行say only“TC001-Functionality 1”和其他选定的测试用例,而不注释套件中的其他测试用例?您可以使用。grep
选项指定一个正则表达式,该表达式根据测试ID(匹配的测试ID正在运行)进行过滤,在指定将运行哪些测试时为您提供了很大的灵活性。最简单的方法是,您只需提供一个短字符串,Intern将使用包含该字符串的ID运行任何测试:
$ node_modules/.bin/intern-runner config=tests/intern functionalSuites=tests/projects/projectA/main grep=TC001