Parallel Execution of Cucumber Scenarios using TestNG | Selenium JAVA

preview_player
Показать описание
In this video, we are going to see that how can we run cucumber scenarios in parallel unsing TestNG.

If you have dependent scenarios in a feature file, then you wont be able to run scenarios in parallel mode.
In that case it doesn't matter whether you are using Junit or TestNG. But if you have independent scenarios in your feature file, then i would suggest you to go for TestNG dataprovider option to run the scenarios.

So create a package with the name like parallel, and placed all your files to the same package. After that write the below code in the runner class.

@Override
@DataProvider(parallel = true)
public Object[][] scenarios()
{
}

Now run your test using TestNG. You will see that all your scenarios are running in parallel mode.

**********Please comment in case of any query*************

Also please watch other videos as well.

Рекомендации по теме
Комментарии
Автор

Is there a way we can execute the scenarios in parallel using testng.xml file (similar to how we can execute feature files in parallel using parallel=true in the testng.xml file)

ammarkhan
Автор

where we need to add chrome driver open code?

DhwaniParikh-vr
Автор

Both drtivers are open but entering user name and password is not working. showing Input must be set

DhwaniParikh-vr
Автор

How to control the thread count using sure fire plug in ? Enabling parallel=true runs all the scenarios in parallel. Can we pass thread value dynamically ? Any references please.

sadakar
Автор

Hi when I'm doing data driven testing in cucumber it is showing no issues
But when I'm doing data driven testing in parallel mode only browser window is opening and all the data is entering into the fields in one window like
In fb
4 browser windows are opening
In that only one window is hitting URL
And all the data is getting entered into username and password field

Can you help me

shreedeevi
Автор

It's not showing scenarios method at
Return super. Scenarios () ;
What should I do sir

shreedeevi
Автор

Hi, Can you please share any git repo for the code. While doing the same i am facing lot of issues.

vijaybadiger
Автор

No need to add the classes to same package and rename the packages as parallel. (maybe earlier it needed)
Also, I tried myself without moving the classes and became successful.
I only added the below code with Maven Surefire plugin configuration

@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}

ksrajith
Автор

when i execute it shows
Failed Configuration : @BeforeClass


what can i do pls reply?

harishkumaar
visit shbcf.ru