7

I am just getting started with Protractor and inherited roughly 40 automated test cases. They are currently meant to run sequentially and are not organized or built to run independently. I am taking a course through Udemy that recommends organizing them within folders and running the folders based off of need (smoketest, regression, etc).

My concern is maintaining multiple versions of the same spec file. For example, if Login.spec.js exists in both the smoketest and regression folder, there will be two different versions of the same file that need to be maintained. Any recommendations or workflows that will help with this?

6

I think you've got it wrong. Organizing test specs into suites in Protractor does not mean you need to copy the file and keep multiple versions of the same file.

Instead, suites is simply a configuration parameter that maps "suite names" into a list of specs. In other way, this is a way to group specs by a certain criteria. Example:

suites: {
    smoke: [
        'login.spec.js',
        'someOthertest.spec.js'
    ],
    performance: [
        'someOthertest.spec.js',
        'performance/*.spec.js'
    ]
},

For more information, take a look:

0

Using jasmine2 framework, tests can also be organized/grouped using a regular expression.

You can add something like @smoke, @regressions to your tests and then only run those ones by passing the grep flag.

it('should do stuff @smoke', function() { ... });

Then run protractor passing the grep flag:

protractor conf.js --grep='@smoke'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.