cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a scenario in scenario outlines when a step fail in cucumbe js?

New Contributor

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!

5 REPLIES 5
Community Hero

Re: How to stop a scenario in scenario outlines when a step fail in cucumbe js?

It's better if you can show us specific code and how you are running this with TestComplete.  

New Contributor

Re: How to stop a scenario in scenario outlines when a step fail in cucumbe js?

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.

 

 

Community Manager

Re: How to stop a scenario in scenario outlines when a step fail in cucumbe js?

BDD experts, what you can suggest? @Wamboo, do you have any suggestions?

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Community Leader

Re: How to stop a scenario in scenario outlines when a step fail in cucumbe js?

Hi,

 

Examples:

|param 1|

|scenario 1|

|scenario 2|

|scenario 3|

 

What Do You mean by this syntax? You are running this outside TestComplete Project?

Community Manager

Re: How to stop a scenario in scenario outlines when a step fail in cucumbe js?

Thanks for your reply, Wamboo!

@Mark_Amrap, did it clarify the situation?

 
---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors