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

Поділитися
Вставка
  • Опубліковано 25 січ 2024
  • 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:
    github.com/prnbtr09/parallelE...
    Singleton Design Pattern:
    • Unlocking Efficiency: ...
    Regards,
    PrinceAutomationDestination
  • Наука та технологія

КОМЕНТАРІ • 51