How to group test cases using regular expression of ng e2e with protractor jasmins3



  • I am using ng e2e --protractorConfig=e2e/protractor.conf.js to run my e2e test.

    I want to add a regular expression like @smoke to this command. But when I add --grep='@smoke' to it as:

    ng e2e --protractorConfig=e2e/protractor.conf.js --grep='@smoke'
    

    I get errors.

    What is the correct way to group test cases?



  • You may group tests as suites like below:

    Conf.js

    suites: { 
            smoke: 'tests/e2e/smoke/*.js', 
            performance: 'tests/e2e/performance/*.js',
          regression: 'tests/e2e/regression/*.js'
     },
    

    And run like below:

     $ protractor conf.js --suite smoke
    

    Using jasmine 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'
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2