mocha-gherkin-ui v0.1.0
Making Gherkin language use with mocha Easy
Mocha Gherkin UI is a Gherkin/Cucumber syntax UI integration for Mocha testing framework.
Allows you to:
- Use common Gherking language to define your features and scenarios.
Feature('some feature', () => {
Scenario('some scenario.', () => {
Given('some precondition', () => {});
And('another precondition', () => {});
When('stimulus', () => {});
Then('postcondition', () => {});
But('another postcondition', () => {})
});
});- Allows you to define special tags to identify your Features or scenarios and filter them in execution
Tag('critical', 'JIRA-1145')
.Feature('some feature', () => {
Scenario('some scenario.', () => {
...
});
});
Feature('some feature', () => {
Scenario('some scenario.', () => {
...
});
Tag('critical')
.Scenario('some scenario.', () => {
...
});
});- And, allows two test execution skip patterns on fail based on the Gherkin language:
Moderated (configured by default) Will allow all complementary steps execution to let you see complete scenario from a main step and will skip the subsequent main steps (Given, When, Then)
Feature: some
Scenario: some
✓ Given prec
✗ And 2nd prec
✓ And 3rd prec
✗ And 4th prec
✓ But 5th prec
- When stimulus
- and another stimulus
- Then postCond
- But another postCondAbsolute: (Concept introduced by @asyncadventures at mocha-steps )
Feature: some
Scenario: some
✓ Given prec
✗ And 2nd prec
- And 3rd prec
- And 4th prec
- But 5th prec
- When stimulus
- and another stimulus
- Then postCond
- But another postCondOriginal: (The one you are used to)
Feature: some
Scenario: some
✓ Given prec
✗ And 2nd prec
✓ And 3rd prec
✗ And 4th prec
✓ But 5th prec
✗ When stimulus
✗ and another stimulus
✗ Then postCond
✗ But another postCondInstallation
NPM:
npm install --save-dev mocha-gherking-uiUsage
Indicate mocha you are going to use mocha-gherkin-ui as a mocha integration using --ui mocha-gherkin-ui option on mocha command:
mocha --ui mocha-gherkin-ui path/to/my/testsIf you like specify which type of skip do you prefer moderate, absolute or original (By default moderate):
mocha --ui mocha-gherkin-ui --mochaGherkinUiSkipMode absolute path/to/my/tests And be able to filter by the tags you gave, the test you want to run
mocha --ui mocha-gherkin-ui --mochaGherkinUiSkipMode absolute --mochaGherkinUiFilterTags critical,system1,anything path/to/my/tests Acknowledgements
Started by studying the code from @iensu in mocha-cakes-2; the good examples in the @mochajs wiki Mocha wiki and the ideas from @asyncadventures mocha-steps