Executing Mocha Scenarios

Mocha scenarios are executed using the Protractor command line interface, and since it's installed as a local module, we need to define an npm script to access it.

Executing the entire test suite

To execute your entire test suite, configure an npm script called, for example, e2e in your package.json:

 {
   "scripts": {
     "e2e": "protractor ./protractor.conf.js"
   },
   "// other properties": "..."
 }

Then issue the following terminal command:

$> npm run e2e

Executing a specific scenario

To execute a specific scenario, configure an npm script called, for example, e2e-scenario in your package.json:

 {
   "scripts": {
     "e2e-scenario": "protractor ./protractor.conf.js --mochaOpts.grep"
   },
   "// other properties": "..."
 }

Then issue the following terminal command:

$> npm run e2e-scenario "Name or partial name of the scenario you want to execute"

Result

If the SerenityBDDReporter is one of the registered Stage Crew Members (which it is by default), issuing the above commands should result in json and png files being generated under target/site/serenity:

├── features                  <- Feature specifications
├── src                       <- Application soures
├── spec                      <- Test sources
├── target                    <- Test execution artifacts
│   └── site
│       └── serenity              <- Serenity BDD JSON and HTML reports 
├── package.json              <- Node.js project file
├── protractor.conf.js        <- Protractor configuration
└── tsconfig.json             <- TypeScript configuration

Please check the chapter on reporting to learn how to convert those intermediary reports into HTML.


Your feedback matters!

Suggest features and improvements on github, get in touch on twitter, and if you found Serenity/JS useful - don't forget to give it a star! ★

Star

results matching ""

    No results matching ""