Suites vs Specs Protractor

2019-01-07 21:52发布

问题:

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.

Example:

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

回答1:

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:

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.