javascript 套件与规格量角器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30331018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Suites vs Specs Protractor
提问by Tyson H.
I have recently picked up a project using Protractor.
我最近使用 Protractor 选择了一个项目。
I am having troubles understand the difference between a suite and a specs. I am also having trouble with a suites when I am running a folder of test's after that folder is ran I run another folder of test and it fails all the test. Any help would be great listed below is what or suite looks like.
我在理解套件和规格之间的区别时遇到了麻烦。当我在运行该文件夹后运行测试文件夹时,我也遇到了套件问题,我运行了另一个测试文件夹,但所有测试都失败了。下面列出的任何帮助都是很好的或套件的样子。
Example:
例子:
suites: {
CSRSmokeTest: '../smoke/Video/**.js'
DesktopSmokeTest: '../smoke/deskTop/**.js'
},
回答by alecxe
Suites are incredibly useful for organizing your tests.
套件对于组织测试非常有用。
The question actually goes down to differences between a suite and a test case in general. Quote from the wikipedia "Test suite" definition:
这个问题实际上归结为套件和测试用例之间的差异。引用维基百科“测试套件”定义:
a collection of test cases that are intended to be used to test a software program to show that it has some specified set of behaviours. A test suite often contains detailed instructions or goals for each collection of test cases and information on the system configuration to be used during testing.
一组测试用例,旨在用于测试软件程序以表明它具有某些指定的行为集。测试套件通常包含每个测试用例集合的详细说明或目标,以及有关测试期间要使用的系统配置的信息。
In other words, a test suite is a collection of specs/testcases united by a common property, logic. For instance, you may have suites for different types of functionality of your application, homepage
, search
etc:
换句话说,测试套件是由一个共同的属性 logic联合起来的规范/测试用例的集合。例如,您可能拥有适用于应用程序不同类型功能的套件homepage
,search
等等:
suites: {
homepage: 'tests/e2e/homepage/**/*Spec.js',
search: [
'tests/e2e/contact_search/**/*Spec.js',
'tests/e2e/venue_search/**/*Spec.js'
]
},
And/or, you may have specs grouped into suites by the type of tests:
和/或,您可能将规格按测试类型分组为套件:
suites: {
smoke: 'tests/e2e/smoke/*.js',
performance: 'tests/e2e/performance/*.js'
},
Or, you may put all of your "regression" tests into a separate suite. Or, you can apply your own logic to group specs.
或者,您可以将所有“回归”测试放入一个单独的套件中。或者,您可以将自己的逻辑应用于组规范。
It is important to note that a single spec can be a part of multiple test suites.
需要注意的是,单个规范可以是多个测试套件的一部分。