Refer Below Link for Docker Commands used in the set up:
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
TOP 50 Selenium Automation Testing Interview Question:
https://automationreinvented.blogspot.com/2020/11/top-50-interview-questions-on.html
Check Selenium Interview questions from 1 to 10 below:
Check Selenium-SDET-UIAutomation Questions set 21 to 30:
Pre-Requisite:
First we need to install docker in the machine using below link: Docker Installation Step
Lets learn about Docker, Selenium Grid and CrossbrowserTesting ==>
Docker Overview:
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
To know more about Docker please refer : https://docs.docker.com/
Selenium Grid
Selenium Grid allows the execution of WebDriver scripts on remote machines by routing commands sent by the client to remote browser instances.
Grid aims to:
- Provide an easy way to run tests in parallel on multiple machines
- Allow testing on different browser versions
- Enable cross platform testing
Interested? Go through the following sections to understand how Grid works, and how to set up your own.
Crossbrowser Testing
Cross Browser testing is a type of non-functional testing that lets you check whether your website works as intended when accessed through: Different Browser-OS combinations i.e., on popular browsers like Firefox, Chrome, Edge, Safari—on any of the popular operating systems like Windows, macOS, iOS and Android.
Lets start with steps to perform cross browser testing with Slenium grid and docker
Step-01:
Download docker in windows :
https://docs.docker.com/docker-for-windows/install/
Step-02:
Go to CMD and type below command:"docker --version"==>
C:\Users\sshukla>docker --version
O/P: Docker version 19.03.8, build afacb8b
Step-03:
Go to below docker hub link and search for images to pull into your local machine:
https://hub.docker.com/search?q=&type=image
Step-04:
Pull all the below three images using docker cmd:
Pull Selenium-hub image using command ~ docker pull selenium/hub
Pull FireFox Debug image using command ~ docker pull selenium/node-firefox-debug
Pull Chrome Debug image using below command ~ docker pull selenium/node-chrome-debug
***********************************************
How to run selenium tests from Jenkins? Maven and Jenkins Integration with Testng-Selenium?Run selenium maven project from command line?
Click Here For Steps with Screenshot
***********************************************
Step-05:
check that the images that has been pulled in step-04 is present by using command: docker images
C:\Users\sshukla>docker images
OUTPUT:
Step:-06
Run the below three commands :
1. docker run -d -p 4446:4444 --name selenium-hub -P selenium/hub
2. docker run -d -P --link selenium-hub:hub selenium/node-chrome-debug
3. docker run -d -P --link selenium-hub:hub selenium/node-firefox-debug
==> Expect below results while running above three commands:
Please execute the first command as mentioned above in the command line:
The expected output for the executed command will be similar to below:
To confirm that the above command executed and container created use below:
==>C:\Users\sshukla>docker ps
OUTPUT:
Please run the following command from the command line:
When you enter the above command in the cmd, you expect a reply as shown below:
To confirm that the above command executed and container created use below:
==> C:\Users\sshukla>docker ps
OUTPUT:
Now let’s move forward and execute the last command:
The expected output for the above command would be as below:
To confirm that above command executed and container created use below:
==> C:\Users\sshukla>docker ps
OUTPUT:
Step:07 Creating Sample Test
Create two tests one for chrome and the other for firefox as below:
PRACTICE BELOW DOCKER COMMANDS in the CMD:
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
****************************************************************
WANT TO KNOW HOW to integrate GRADLE + TESTNG + JENKINS CI-CD , click on below link for entire steps with screenshot:
How
to run test automation TestNG suite with gradle from jenkins job?
Jenkins Integration with Gradle and TestNG.xml suite?Run TestNG suite
with Gradle?
******************************************************************
Step-08:
Create a testng xml file with parallel as tests and thread count=2 as we are trying to execute the test in two browsers in parallel
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Automation Test Suite " parall="tests" thread-count="2">
<test name="Automation Test CasesChrome">
<classes>
<class name="com.task.automation.testtwo.testone"/>
</classes>
</test>
<test name="Automation Test Casesfirefox">
<classes>
<class name="com.task.automation.testtwo.testfirefox"/>
</classes>
</test>
</suite>
************************************************
GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT
************************************************
Thank you for reading this article… Have a nice day!
Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session
Check Selenium-SDET-UIAutomation Questions set 41-50:
Q&A Set 41-50
Check Selenium-SDET-UIAutomation Questions set 51-70:
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions