Mastering Parallel Execution: Overcoming Challenges in Selenium Testing || TestNG

preview_player
Показать описание
Hello Everyone,

Welcome to my channel PrinceAutomationDestination.

🚀 Parallel Execution Challenges & Resolution in TestNG:

📌 Parallel Execution is one of the important aspect of Test Automation framework as it helps in achieving quick execution.

As a result it become important Interview question to Automation Engineers. So, Today's topic is parallel Execution challenges and resolution in TestNG Framework.

📌 How do you achieve parallel Execution in your TestNG based Automation Framework

Answer from most of people is:

1. provide parallel = methods|tests|class

2. provide thread-count=2|3|4|5

But are not aware about, How thread safety is being taken care i.e. how to avoid interference of parallelly executing Threads.

📌 Challenges with Automation Implementation:

✅ We need a single isolated driver per Thread and by default when we create static/Singleton driver instance, it is not Thread Safe

So, We get Thread Interference and as a result we get uneven results of execution and come across following errors

1. NullPointerException

2. SessionNotCreated

3. NoSuchElementException

4. and So On

📌 BIG Question is: How to resolve it

✅ There is a concept of Thread Local Class in Java using which we can store the value of variable for each thread and same thread would be able to retrieve it and thus avoid interference of threads.

✅ So we are going to use the same concept in case of Parallel Execution by creating Thread Local Instance for both static as well as Singleton Instances

Link to Repo:

Singleton Design Pattern:

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

This is one of the hidden gem on TestNg with parallel execution challenges. Nicely explained . Hats off

balajivivek
Автор

hello Mr. Prince, I don't know if you remember me, but I tried to learn your framework and facing this situation, I reached you and you promised to create this parallel content. And you kept it! I'm very appreciated that. Merry Christmas and happy new year! Wish you all the best!

hoangnguyenduc
Автор

Prince great content. no words to express...love you man

Karthickraj.pattabi
Автор

Very good explaination in detail with working code...Cheers

vikashkeshri
Автор

Thank you for sharing this fascinating video; I hope this is the finest explanation.

sahiljoshi
Автор

Very nicely explained tutorial Sir, thank you very much !!

bongtube
Автор

Thanks for the clear cut explanation 👍🏻👍🏻

karthikeyans
Автор

Good explanation, would like to see more videos on your playlist

spidyniks
Автор

Post a video on Crossbrowser testing with some realtime examples sir

Elliot-
Автор

Good explanation ❤
As per my opinion for better understanding any topic start with new project then easy to fallow up your code
Thank You

Jansuraajbr
Автор

why in singelton class not declare driver variable as staic any reason for it?

hashirhasmy
Автор

Thank you for this video, I also use singleton trying your example but my tests are failed

АринаНичко
Автор

is it possible to assign returning driver value from singelton class to normal driver like this from test case having class.
Webdriver driver =
is this approach fine to use driver reference variable in side test class

hashirhasmy
Автор

In BDD cucumber series for making ThreadSafe you just declare ThreadLocal<WebDriver> driver= new ThreadLocal<>(); But here in this video you are setting values also like driver.set(new ChromeDriver()); also getting it driver.get() could you please explain this ?

sushantbhakare