0% found this document useful (0 votes)
241 views

TMB - Selenium - Java With Docker, Git and Jenkins

The document provides an overview of a Selenium automation course covering topics like Java, Docker, Git, Jenkins, TestNG, Page Object Model, and more. The course teaches building a Selenium test framework with Java, using tools like Maven for dependencies, TestNG for testing, and designing according to the page object model pattern. It also covers test reporting with ExtentReports and running tests in parallel on multiple browsers.

Uploaded by

Neel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views

TMB - Selenium - Java With Docker, Git and Jenkins

The document provides an overview of a Selenium automation course covering topics like Java, Docker, Git, Jenkins, TestNG, Page Object Model, and more. The course teaches building a Selenium test framework with Java, using tools like Maven for dependencies, TestNG for testing, and designing according to the page object model pattern. It also covers test reporting with ExtentReports and running tests in parallel on multiple browsers.

Uploaded by

Neel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

====================================================

Tutor: Amuthan Sakthivel


Reference: Testing Mini Bytes
Course: Selenium - Java with Docker, Git, and Jenkins
====================================================
1. Course URL:
https://www.testingminibytes.com/courses/selenium-java-with-docker-git-and-jenkins
2. Document prepared by: Rajat Verma
a. https://www.linkedin.com/in/rajat-v-3b0685128/
b. https://github.com/rajatt95
c. https://rajatt95.github.io/

--------------------------------------------------
1. Learnings from Course
a. Web Application:
i. https://opensource-demo.orangehrmlive.com/
b. Why
i. Automation?
ii. Selenium?
iii. Java?
c. IDE:
i. IntelliJ
1. Plugin
a. Rainbow brackets
b. Sonarlint
c. Create TestNG XML
2. Templates
a. Pre-Defined:
i. main - - > main() method
ii. sout - - > System.out.println()
b. Custom:
i. Settings -> Live Templates -> Java
ii. dfbi - - > driver.findElement(By.id(“”))
d. Java basics:
i. JDK vs JRE
ii. Compiler - javac
iii. Why do we set environment variables?
iv. Human readable (.java files) code and Machine-readable code (.class files)
v. Data Types
vi. BODMAS

1
vii.
if, if-else, if-else if-if
viii.
&&, ||
ix.
For Loop
x.
Method calling
xi.
Array
xii.
ArrayList
1. Dynamic
xiii. String
1. length()
2. substring()
3. chartAt()
4. toLowerCase()
5. toUpperCase()
6. replace()
xiv. Variables:
1. Local
a. Present inside method
b. scope is within the method
2. Global
a. present outside method
b. scope is within the method
e. XPaths:
i. Absolute
ii. Relative
1. XPath axes
a. Parent (/..)
b. Ancestor
c. Preceding-sibling
d. Following-sibling
e. Bi-Traverse
2. XPath functions
a. text()
b. contains()
iii. Dynamic XPaths:

1.
f. Maven:
i. Build and Dependency Management Tool

2
g. WebDriverManager
i. To manage the Drivers for different browsers and different platforms
h. Java:
i. Class and Objects
ii. Constructor and Constructor Overloading
iii. Method Overloading
iv. Keywords
1. super
2. this
3. final
4. static
5. try
6. catch
7. finally
v. OOPS concepts
1. Abstraction
2. Encapsulation
3. Inheritance
a. Single Level
b. Multi-Level
4. Polymorphism
a. Static - Method Overloading
b. Dynamic - Method Overriding
5. Composition
vi. Access Modifiers
vii. Abstract classes
viii. Interface
1. From Java 8,
a. We can have default methods (has a body) in Interfaces
b. These methods can be overridden as well
c. All the sub-classes will not be forced to implement these
methods.
d. But, sub-classes have to implement all the abstract methods
ix. Typecasting
1. UpCasting
2. DownCasting
x. Static Block
xi. Scanner class
xii. String Arguments in main() method
xiii. Exception Handling
xiv. Array
xv. Reflection

3
xvi. Loops
1. For
2. ForEach
xvii. List, Set, Map
xviii. Static Imports
xix. Enums
xx. POJO
i. Selenium:
i. WebElements
1. Dropdown:
a. Bootstrap dropdown
b. Select dropdown
ii. Locators:
1. id
a. Recommended
b. Works fine with MultiLingual sites
2. name
3. xpath
iii. Actions class
iv. Frames Handling
v. File Upload
vi. JavascriptExecutor
vii. TakesScreenshot
viii. WebDriver Hierarchy
ix. Waits:
1. Thread.sleep() -> not recommended
2. Implicit
3. Explicit
4. Fluent
x. ChromeOptions
1. Headless execution
j. TestNG
i. Reporting Capability
ii. Annotations
1. @BeforeSuite
2. @BeforeTest
3. @BeforeClass
4. @Test
5. @AfterMethod
6. @AfterClass
7. @AfterTest
8. @AfterSuite
Suite - - > Test - - > Class - - > Method

4
Suite is a collection of multiple Tests
Test is a collection of multiple Classes
Class is a collection of multiple Methods
9. DataProviders
10. Listeners
a. ITestListener
iii. Annotations Properties
1. priority
2. description
3. invocationCount (default =1)
4. threadPoolSize (Parallel execution)
5. timeOut (max. Time for Test case)
6. dependsOnMethods
7. groups
8. dependsOnGroups
iv. Assert class and its methods
k. Maven:
i. Dependencies management
ii. Profile management in Maven
l. Apache POI
m. Owner library
n. To read values from the .properties file
o. Page Object Model
i. Method Chaining
ii. Page Chaining
iii. Why no to Page Factories?
p. Faker library
q. ExtentReports
i. Custom Annotation
r. Github
s. Docker
t. Amazon AWS EC2
u. Git
v. Jenkins
w. Automation Framework:
i. Automation Testing Tool: Selenium Webdriver API
ii. Programming language: Java (Version 11)
iii. Build ad Dependency Management Tool: Maven
iv. Testing framework: TestNG
v. Design Pattern: Page Object Model (No Page Factories)
vi. Reporting: ExtentReports (Latest version - 5.0.9)
vii. To read property files:
1. Owner library

5
https://mvnrepository.com/artifact/org.aeonbits.owner/owner
viii. Instead of DataProvider, we are going to use
1. Test Data Supplier
https://mvnrepository.com/artifact/io.github.sskorol/test-data-sup
plier
ix. To read values from the Excel file:
1. Test Data Supplier
x. Custom Annotation
1. For ExtentReport:
a. Author
b. Category
xi. Custom Enums
xii. OOPS concepts:
1. Abstraction
2. Encapsulation
3. Inheritance
a. is-a
4. Polymorphism
5. Composition
a. has-a
xiii. Supports Parallel Cross Browser Testing
1. Using ThreadLocal class
xiv. Other implementations:
1. Icons for Browser added on Test level
2. OS and Browser with version info added on Test level
3. Zip all the ExtentReports
4. Users can do customizations:
a. Send Email to n no. of Recipients with n no. of Reports as
attachments
b. Re-try failed test cases
c. Screenshots on Test step level

--------------------------------------------------
Softwares:
1. Java JDK
2. IntelliJ IDE
a. Plugin -
i. Rainbow Brackets
ii. Sonarlint
--------------------------------------------------

6
-----------------------------------------
========1_Java Installation | JDK and JRE | IntelliJ Installation==========
-----------------------------------------

1. Why Automation?
a. Reduce Manual Efforts
b. Reduce Testing Timeline
c. Reduce Manual Error
d. Reduce Regression Testing Efforts
e. Reduced Cost
f. High Pay
--------------------
2. Why Selenium?
a. Open-source (Free)
b. Wide User base
c. Supports multiple languages (Java, C#, Python, Ruby)
d. Supports multiple browsers (Chrome, Safari, Edge, Firefox, Opera)
i. Testing of a web application across different browsers is called Browser
compatibility Testing.
e. Supports multiple OS (WIN, MAC, Linux)
f. Supports Parallel Execution
g. A lot of High Paying jobs
h. Acts like base if you want to learn Appium
i. Selenium - Web Applications, Appium - Mobile Applications
--------------------
3. Why Java?
a. Open-source
b. Widely used
c. Matured language existing over 20 years
d. Used in multiple companies
e. A lot of libraries available
f. Based on OOPS
g. Selenium with Java have most of the jobs in the market
h. Web Automation - Selenium with Java
Mobile Automation - Appium with Java
API Automation - RestAssured with Java
i. To automate the web application, we are going to use Java as a programming
language and Selenium WebDriver API
j. Download Java
i. https://www.oracle.com/in/java/technologies/javase/javase8-archive-dow
nloads.html
ii. WIN (64-bit): jdk-8u202-windows-x64.exe

7
iii. MAC: jdk-8u202-macosx-x64.dmg
k. Install Java
i. Install
ii. Set the environment variables
1. Why do we need to set this?
a. Because we want to use Java globally/from any location of my
machine
l. Java compiler is responsible for conversion of
i. Human readable code -> Machine Readable Code (0’s and 1’s)
(.java file) -> (.class file)
ii. Location:
1. WIN:
a. C://Program Files//Java//jdk1.8.0_281/bin/javac
m. JDK:
i. Java Development Kit
ii. We can develop Java apps and run/execute Java apps
iii. We can both
1. develop Human Readable Code (.java files)
2. run/execute Machine Readable code (.class files)
n. JRE:
i. Java Runtime Environment
ii. We can only run/execute Java applications
iii. We can only run/execute Machine Readable code (.class files)
1. JRE does not have a javac compiler
2. WIN:
a. C://Program Files//Java//jre1.8.0_281/bin/java
b. Only java is present inside JRE, no javac is available

--------------------
4. Java Compiler:

a.

8
b.

c.
d. Test.java -> Human Readable Code
e. Test.class ->
i. Machine Readable Code
ii. Platform Independent
f. Commands:
i. To compile the Test.java file
1. javac Test.java
a. This file(Test.java) will get compiled and a new file
(Test.class) will be generated.
b. This file (Test.class) is platform-independent.
ii. To execute/run Test.class file
1. java Test
--------------------
5. Variables:
a. WIN:
i. User variables - works only for specific User
ii. System variables - works for all the User who logs into the machine

9
iii.

--------------------
6. IDE:
a. Integrated Development Environment
i. It comes with many features
1. Highlights the Erro before you compile the code
2. Can integrate other tools as plugins
a. TestNG
b. Cucumber
b. Example:
i. Eclipse
ii. IntelliJ
c. Why IntelliJ?
i. It has really cool features in comparison of Eclipse
d. Download IntelliJ:
i. https://www.jetbrains.com/idea/download/#section=mac
ii. You can download the Community version

--------------------

10
-----------------------------------------
=====2_First Java Code in IntelliJ | int | String | Arithmetic Operators=======
-----------------------------------------

1. Create a new Java Project in intelliJ IDE:

a.

b.

11
c.

d.
e. Program exit with code 0 is OK

--------------------

-----------------------------------------
========3_If | If Else | For loop | BODMAS | AND - OR Operator==========
-----------------------------------------

1. BODMAS
a. BODMAS is an acronym to help children remember the order of mathematical
operations – the correct order in which to solve maths problems. Bodmas stands for
B-Brackets, O-Orders (powers/indices or roots), D-Division, M-Multiplication,
A-Addition, S-Subtraction.
--------------------

12
-----------------------------------------
========4_Assignment Solutions | Methods | Arrays==========
-----------------------------------------

1. Plugin:
a. Rainbow Brackets

b.
2. Array:
a. Collection of similar data type
b. Contiguous memory location
c. Issue -> Fixed-size

d.

--------------------

13
-----------------------------------------
=======5_Selenium Getting Started | Writing First Selenium Script========
-----------------------------------------

--------------------

1. Each website has its DOM


2. Developers had written code for
a. How web elements will be rendered over Web Page
b. Web Elements:
i. TextBoxes
ii. Buttons
iii. Links
iv. Checkboxes
v. Radio buttons
vi. Image

-----------------------------------------
========6_Locating Strategies | Mastering XPath==========
-----------------------------------------

1. XPath types:
a. Absolute
i. Lengthy and Error-prone
ii. Starts-with /
b. Relative
i. Recommended to use
ii. Starts-with //

2.

14
3.

-----------------------------------------
========7_Relative XPath | Double Slashes==========
-----------------------------------------

-----------------------------------------
========8_Assigment Solution | FindElements | Arraylist==========
-----------------------------------------

1. Amazon
--------------------

-----------------------------------------
========9_Dynamic XPath | Method Overloading | Manipulating String |
Sharing Java Project==========
-----------------------------------------

1.

15
2.

--------------------
1. Dynamic XPaths:
i.

ii.

-----------------------------------------
=====10_Select Dropdown | Organising Locators | Maven Introduction======
-----------------------------------------

1. Dropdown:
a. Bootstrap dropdown
b. Select dropdown

i.
ii. To handle this type of Dropdown, we have a class “Select” provided by
Selenium WebDriver API
iii. Methods in Select class
1. selectByValue()

16
2. selectByVisibleText()
3. selectByIndex()
4. getOptions()
2. Maven:
a. Build and Dependency Management tool
b. Automatically creates a structure for project
i. Developers:
1. main java - - > Development code
2. main resources - - > Configuration files
3. test java - - > unit tests - - > code written to verify whether the
created methods are working fine
4. test resources - - > Configuration files required to perform Unit
testing
ii. Testers:
1. main java - - > anything that is not test
2. test java - - > automated tests
3. test resources - - > Configuration files - - > Excel (contains Test data)

17
-----------------------------------------
========11_WebDriverManager| Classes and Objects==========
-----------------------------------------

1. Classes and Objects:

a.
i. id, firstName, lastName, age, companyName are
1. Field
2. Variables
3. Data Member

b.

18
c.
d. Each Object has its own properties
2. Class is like a Blueprint that an Object follows
3. Classes can have:
a. Variables/Fields/Data Members
i. What they possess
b. Methods
i. What they can do
4. Default values for:
a. int -> 0
b. String -> null
c. Boolean - false

5.

19
-----------------------------------------
========12_All about Constrcutors==========
-----------------------------------------

1. Constructor:
a. It helps to construct the object of a class
b. Same name as class name
c. Special method
d. It has no explicit return type
e. Types:
i. Default
ii. Parameterized
3. Default Constructor is available in every class by default
a. You can check this in the .class file (using IntelliJ IDE)

b.

c.

20
-----------------------------------------
========13_Actions class | Drag and Drop | Frames==========
-----------------------------------------

1. Templates:
a. Pre-Defined:
i. main - - > main method
ii. sout - - > System.out.println
b. Custom:
i. Settings -> Live Templates -> Java

ii. Dfbi - - > driver.findElement(By.id(“”))

--------------------

21
-----------------------------------------
========14_File Upload | Inheritance | Encapsulation | Abstration=========
-----------------------------------------

1. File Upload:
a. Check
i. DOM ->
1. Tag name is input
2. type=”file”

ii.

2.

--------------------
1. OOPS concepts:
a. Encapsulation
b. Inheritance
c. Abstraction
d. Polymorphism
--------------------

1. Encapsulation
a. Private Variables/Fields/Data Members
Public methods
b. Used to restrict the user to directly access the variable
c. We get more control over the variables
i. We can put condition checks before setting the value as well
1. In Setters
d. Hiding the implementation details and exposing only the functionality

22
e.
--------------------

2. Inheritance
a. Base and Derived
Super and Sub
Parent and Child
b. “is-a” relationship
c. Dog extends Animal
Cat extends Animal
i. Dog and Cat are child classes
ii. Animal is parent class
iii. Dog is-a Animal
Cat is-a Animal
d. Parent class will have similarities which are common in Child class
e. NOTE:
i. Animal animal1 = new Dog();
1. The object for the Dog
2. A reference type is now Parent class (Animal)
ii. List list1 = new ArrayList();
This type of implementation is required when we want to change the
implementation at runtime.

f. We have 2 concepts
i. Interface
1. Used for 100% Abstraction
2. Methods will have no body/implementation
3. If any class_A implements Interface_B

23
a. class_A has to override the methods present in Interface_B
ii. Abstract classes
1. Used for partial Abstraction
2. Abstract methods will not have any body/implementation
3. If any class_A extends Abstract class_B
a. class_A has to override the abstract methods present in
Abstract class_B
g. Summary for Inheritance:
i. We use Inheritance - - >
1. Similarities in the class
2. Code Re-usability
3. is-a relationship
4. Object with Parent Reference type - - > Liberty to create a required
child object
5. Method in parent class - - > Do not want this behavior - - > Child can
implement its own behavior
6. This is Method Overriding - - > Dynamic Polymorphism
ii. Method Overloading - - > Static Polymorphism
--------------------

-----------------------------------------
======15_Multi Level Inheritance | Final keywords | Constructor calls======
-----------------------------------------

1. Typecasting
a. UpCasting
i. Happens implicitly
ii. Example:
1. Animal animal = new Dog();
b. DownCasting
i. Has to be done explicitly
1. Animal animal = new Dog();
(Dog(animal)).bark();

--------------------
1. Multi-Level Inheritance:
a. Dog extends DomesticAnimal
b. DomesticAnimal extends Animal

24
c.
--------------------
1. Final Keyword
a. Variable - - > value can not be changed
b. Method - - > can not be overridden
c. Class - - > can not be inherited
i. If any class tries to extend final class, then,
1. Message: Cannot inherit from final class
--------------------
1. Constructor calling Order:
a. When we create the object of Child class,
i. Constructor of parent class gets called first
ii. Grandfather -> Father -> Son

--------------------

-----------------------------------------
========16_Super Keyword, Problems with Multiple Inheritance=========
-----------------------------------------

1. Abstract class:
a. We can not create instance/object of Abstract class
i. These classes are not Concrete
ii. Message: Abstract class can not be instantiated
b. If we have even 1 abstract method, then, that class has to be declared as an Abstract
class.
c. Using @Override annotation is not mandatory
This is juts for our understanding.

25
d. Abstract methods defines the Skeleton

e.

--------------------
1. Access Modifiers:

a.

b.
--------------------

26
-----------------------------------------
========17_Static Variable and Method | Interface | Static Blocks =========
-----------------------------------------

1. Multiple Inheritance:
a. Not possible with classes
b. Possible with Interface
i. ClassA implements InterfaceA, InterfaceB, InterfaceC
--------------------
1. Static:
a. Keyword
b. Can be used with variable and method
c. Used for Memory Management
d. Static variables are common/shared for all the Objects
e. They are not specific to particular objects.
f. You can access static variables and methods directly with class name
i. No need to create an object and call

g.
h. Static methods deal with static variables only
--------------------
1. Interface:
a. Only have abstract methods
i. No body/implementations
b. Used to define the Skeleton/Rules
c. Methods -> public static
Variables -> public static final
d. Interface does not have any Constructor
e. InterfaceA extends InterfaceB
ClassA extends ClassB
ClassA implements InterfaceB
ClassA implements InterfaceA, InterfaceB
--------------------
1. Static Block:
a. Executes even before main() method

27
--------------------
-----------------------------------------
======18_Scanner Class, String Arguments in Main, TestNG basics========
-----------------------------------------

1. String Arguments in main() method:

2.

--------------------
1. TestNG:
a. Open source Testing framework
b. Reporting Capability
i. Tests execution
1. Project location ->
a. test-output ->
i. Emailable-reports.html
ii. Index.html
c. Annotations:
i. Test
d. Properties with Annotation:
i. priority
--------------------

-----------------------------------------
========19_TestNG Annotations in Details | TestNG XML | Groups=========
-----------------------------------------

1. @BeforeSuite // create DB connections, Reports initialization


2. @BeforeTest
3. @BeforeClass
4. @BeforeMethod //launch the Browser
5. @Test
6. @AfterMethod // to quit the Browser
7. @AfterClass
8. @AfterTest
9. @AfterSuite // close DB connection, Reports flush

28
Suite - - > Test - - > Class - - > Method
1. Suite is a collection of multiple Tests
2. Test is a collection of multiple Classes
3. Class is a collection of multiple Methods

--------------------
1. All tests need to be independent.
--------------------

-----------------------------------------
======20_JavascriptExecutor | TakesScreenshot | Variable Arguments=====
-----------------------------------------

1. JavascriptExecutor:
a. It is an interface with the help of which we can execute Javascript code using
Selenium WebDriver.
b. Methods:
i. executeScript()
2. JavascriptExecutor jse = (JavascriptExecutor) driver;
This is an example of Downcasting.
--------------------
1. TakesScreenshot:
a. It is an interface
b. It is used to take the screenshot of the page
c. Method:
i. getScreenshotAs()

--------------------
1. WeDriver Hierarchy:

29
2.
--------------------

-----------------------------------------
========21_Exception Handling in Java | All you need to know==========
-----------------------------------------

1. Exceptions:
a. Checked Exception
i. Compile-time Exception
ii. InterruptedException, IOException,
b. Unchecked Exception
i. Run time Exception
ii. ArithmeticException, IndexOutOfBoundsException, FileNotFoundException
iii. Selenium Exceptions:
1. NoSuchElementException

30
2. Exception Chaining

--------------------

31
-----------------------------------------
========22_2D Array | Data Provider | Extent Reports==========
-----------------------------------------

1. 2-D Array:

2. All the classes are sub-classes of the Object class in Java

--------------------
1. Data Providers:

a.

32
--------------------
1. ExtentReports:

a.
--------------------

-----------------------------------------
=23_TestNG and Extent Reports Integration | Excel Reading using Apache POI=
-----------------------------------------

1. Apache POI

a.

33
b.

--------------------

-----------------------------------------
======24_Excel-Dataprovider Integration | Listeners | Set and Map========
-----------------------------------------

--------------------
1. Apache POI and DataProvider:

a.

34
b.

--------------------
1. Listeners
a. ITestListener
i. In latest version of TestNG,
1. Methods inside the ITestListener interface are default methods
2. It is not mandatory for sub-classes to implement those methods

35
ii. In the older version of TestNG,
1. Methods inside the ITestListener interface were abstract methods
2. It was mandatory for sub-classes to implement those methods

--------------------
1. How can you remove the duplicates from the list?
a. Add elements inside to a Set.
b. Set does not allow duplicates.
i. Set<String> set = new HashSet<>(list);
ii. Set does not maintain the Insertion order.
--------------------
1. Map:
a. Key-Values

36
b. No duplicate keys are allowed
c. If we have 2 values with the same Key, then, the new value replaces the old value
d. Map also does not maintain the Insertion order

e.
--------------------

-----------------------------------------
========25_Dataprovider with Hashmap | Property File Reading==========
-----------------------------------------

1. DataProvider with HashMap

a.

37
b.

c.

38
--------------------
1. Owner library:
a. To read values from the .properties file in a smart way

b.

c.

39
d.

--------------------

-----------------------------------------
====26_Waits in Selenium | ChromeOptions and Headless | Docker Intro===
-----------------------------------------

1. Waits
a. Implicit
b. Explicit
i. Polling - 500 ms
c. Fluent
Do not mix implicit and explicit waits.
Go with Explicit. It is recommended to use.
--------------------
1. Headless:

40
a.
--------------------
1. Docker:
a. Can execute test scripts on a browser with any specific version
i. For Browser Compatibility testing
b. Download it:
i. https://www.docker.com/products/docker-desktop
c. Terminal:
i. docker
This command must give other options
d. Using Docker, we can create multiple Containers
e. We’ll set up a Selenium Hub and attach all the containers with it
f. Containers are like
i. Taking a PG and start living there

41
-----------------------------------------
========27_Execute Test in Docker | Framework Creation Intro==========
-----------------------------------------

1.

2.

42
--------------------------------------------------------------------------------

1.

2.
--------------------------------------------------------------------------------

43
1.

2.

3.
--------------------------------------------------------------------------------

44
1. Terminal:
a. docker ps
This command lists down all the Docker containers which are in running state.
2. Go to
a. https://hub.docker.com/
b. Search for: selenium/standalone-chrome
https://hub.docker.com/r/selenium/standalone-chrome
https://hub.docker.com/r/selenium/standalone-chrome/tags
3. Terminal:
a. docker pull selenium/standalone-chrome:96.0
This command will download/pull the image from Docker Hub to your local
machine.
b. docker images
This command will list out all the available images in your local machine.
c. docker run -p 4444:4444 -p 7900:7900 selenium/standalone-chrome:96.0
i. Left 4444 -> Local machine port
ii. Right 4444 -> Container image port
This command will start/run the container.
d. http://localhost:4444/
This URL is to see the Docker container status
e. http://localhost:7900/
This URL is to see the live execution in the Docker container
Password: secret
Check this:
i. https://github.com/SeleniumHQ/docker-selenium
f. docker start name/ID
This command will start the container.
g. docker rm name/ID
This command will remove the container.
h. docker stop name/ID
This command will stop the running container.
i.

--------------------------------------------------------------------------------

1.

45
2.

3.
--------------------------------------------------------------------------------

46
-----------------------------------------
========28_Run Selenium Tests in AWS EC2==========
-----------------------------------------

1. If our laptop is not that good


a. Which we can use for Docker setup
2. Then, we can use
a. Amazon EC2 (Elastic Compute Cloud)
b. Go to https://aws.amazon.com/
c. Do Signup
d. Create a Free tier instance

3.

4.

47
5.

-----------------------------------------
==29_Driver Factory | Config Factory | Parallel execution with ThreadLocal ===
-----------------------------------------

1. ThreadLocal
a. Class to handle Multi-Threading
b. This will be helpful for Parallel execution
c. It helps to create objects that are read and written by the same thread

-----------------------------------------
========30_Creating Page Layers | Page Components | Composition |
Understanding Page Object Model==========
-----------------------------------------

1. Page Object Model


a. Method Chaining

i.

48
b. Page Chaining

i.

ii.

-----------------------------------------
========31_Method Chaining | SeleniumUtils | Static Imports | Dynamic
Locators and Java Faker ==========
-----------------------------------------

1. Why no to Page Factories?


a. Dynamic Locators are not possible
b. In every Page class,
i. PageFactory.initElements(driver, this);
is mandatory
--------------------
1. Java Faker API

49
a.

-----------------------------------------
========32_Enums | Extent Report Integration with Framework==========
-----------------------------------------

-----------------------------------------
=33_Listeners Integration with Framework | Annotation, and Usage in
Framework =
-----------------------------------------

-----------------------------------------
========34_Excel and Test Data Supplier - Github and Git==========
-----------------------------------------

1. Instead of DataProvider, we are going to use


a. Test Data Supplier
https://mvnrepository.com/artifact/io.github.sskorol/test-data-sup
plier
Version - 1.9.7
2. To read values from the Excel file:
a. Test Data Supplier

--------------------
1. Test Data Supplier:
a. This library is built over Ownercell
b. This can read the values from JSON, YAML, xlsx, CSV files.
i. NOTE:

50
1. Make sure, you are using Java 11 in Build path
2. Otherwise, it may result as:

--------------------------------------------------------------------------------

1.

2.

51
3.

--------------------------------------------------------------------------------
1. Now, if you want to filter for specific test cases, you need specific data, then,

a.

--------------------
1. Git:
a. Open IntelliJ
b. VCS -> Share Project on Github

52
c.
d. Code -> Commit -> Push to specific branch
e. Pull
f. Pull Request (to merge develop branch into master)
g. Merge-Conflicts handle

-----------------------------------------
========35_Local and Remote Driver Factories | Git and Jenkins
Integration==========
-----------------------------------------

1. Profile management in Maven:

a.
b. mvn clean test -Psmoke

53
i. mvn -> We are using the Maven command
ii. clean -> Whatever is present in the target folder will be removed
iii. test -> Maven Goal
iv. -Pall -> We are specifically executing smoke Profile

--------------------
1. Jenkins
a. CI/CD Tool
b. Create job as Freestyle Project
c. Execute from
i. Local machine
ii. Remote (Github/Bitbucket)
d. Build Parameters
e. Scheduling

=======================================================================

54

You might also like