How to stop a scenario in scenario outlines when a step fail in cucumbe js?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to stop a scenario in scenario outlines when a step fail in cucumbe js?
In the scenario outline, I would like to skip steps when a step fails in a scenario and to continue on the following scenario.
for example :
Examples:
|param 1|
|scenario 1|
|scenario 2|
|scenario 3|
If a step fails in scenario 1, I would like to continue directly to scenario 2 and not executing all the following steps in scenario 1 after the step fails.
Thanks for the answers!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's better if you can show us specific code and how you are running this with TestComplete.
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok so for example :
Fonctionnalité: workflow de connexion recherche et déconnexion
Plan du scénario: A description of your business scenario
Etant donné que Je suis sur la page de connexion de la "<plateforme>"
Quand Je renseigne mon login "<Login>"
Et Je renseigne mon mot de passe "<mdp>"
Exemples: |plateforme |Login |mdp | | FirstDataSet.com|aLogin|aMdp| | SecondDataSet.com|aLogin|aMdp| BeforeScenario(function () { Browsers.Item(btChrome).Run() // Sys.Browser().BrowserWindow(0).Keys("^n"); Sys.Browser().BrowserWindow(0).Maximize(); }) AfterScenario(function () { Sys.Browser().Close(); }) Given("Je suis sur la page de connexion de la {arg}", function (url){ this.url = url; try { //Renseigne le lien de la plateforme Browsers.Item(btChrome).Navigate(this.url + '/externe'); //Vérifie que la page de connexion est bien affichée Sys.Browser("*").Page('https://' + url + '/auth/login').QuerySelector("div h1"); Log.Checkpoint("PASS: Login page is displayed", "", pmHighest, null, Sys.Desktop); } catch (e) { Log.Error("FAIL: Cannot display the login page"); } }); When("Je renseigne mon login {arg}", function (login){ try { Sys.Browser("*").Page("*").QuerySelector('input[name="logineu"]').SetText(login); Log.Checkpoint("PASS: login input", "", pmHighest, null, Sys.Desktop); } catch (e) { failedStep = 'style'; Log.Error("FAIL: Cannot find 'name' text input"); } }); When("Je renseigne mon mot de passe {arg}", function (mdp){ try { Sys.Browser("*").Page("*").QuerySelector('input[name="password"]').setText(mdp); Log.Checkpoint("PASS: password input", "", pmHighest, null, Sys.Desktop); } catch (e) { // Posts an exception message to the test log Log.Error("FAIL: Cannot find 'password' text input"); } });
So for exemple in that code, if the login step fail, I would like to skip the password step to go directly in the AfterScenario and to continue directly to the next data set in my scenario outline tab, instead of executing all steps in the scenario of my first data set after the failing step.
And simply running this by running my feature file.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BDD experts, what you can suggest? @Wamboo, do you have any suggestions?
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Examples:
|param 1|
|scenario 1|
|scenario 2|
|scenario 3|
What Do You mean by this syntax? You are running this outside TestComplete Project?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply, Wamboo!
@Mark_Amrap, did it clarify the situation?
Tanya Yatskovskaya
SmartBear Community and Education Manager
