套件与规格量角器 [英] Suites vs Specs Protractor

查看:27
本文介绍了套件与规格量角器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 Protractor 选择了一个项目.

I have recently picked up a project using 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.

示例:

suites: {
    CSRSmokeTest: '../smoke/Video/**.js'
    DesktopSmokeTest: '../smoke/deskTop/**.js'
},

推荐答案

套件对于组织测试非常有用.

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.

换句话说,测试套件是由一个公共属性、逻辑联合起来的规范/测试用例的集合.例如,您可能拥有适用于应用程序不同类型功能的套件,homepagesearch 等:

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:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆