SlideShare une entreprise Scribd logo
1  sur  32
Test Automation Using
Selenium
Swati
Email- swati@knoldus.com
History of The Selenium
●

●

Selenium is invent by Jason Huggins
He developed a Javascript library that could drive interactions
with the page, allowing him to automatically rerun tests against
multiple browsers.
Test Automation
●

Test automation is the use of software
To set test preconditions.
To control the execution of tests.
To compare the actual outcomes to predicted outcomes.
To report the Execution Status.

●

Commonly, test automation involves automating
a manual process already in place that uses a
formalized testing process.
Why and When To Automate?
Frequent regression testing
● Repeated test case Execution is required
● User Acceptance Tests
● Faster Feedback to the developers
● Reduce the Human Effort
● Test same application on multiple environments
●
Selenium
●

●

●

Selenium is a robust set of tools that supports rapid
development of test automation for web-based
applications.
Selenium provides a rich set of testing functions
specifically geared to the needs of testing of a web
application.
Selenium operations are highly flexible, allowing many
options for locating UI elements and comparing
expected test results against actual application
behavior.
Selenium Features
●

●

●
●

●
●

Supports Cross Browser Testing. The Selenium
tests can be run on multiple browsers.
Allows scripting in several languages like Java,
C#, PHP and Python.
Ajax/CSS support.
Assertion statements provide an efficient way of
comparing expected and actual results.
Inbuilt reporting mechanism.
Selenium is an open source tool
Selenium Components
●

Selenium IDE

●

Selenium Remote Control

●

Selenium Grid
Selenium IDE
●
●

●

●

●

●

Previously known as Selenium Recorder
Selenium IDE is an integrated development environment
for Selenium tests.
It is implemented as a Firefox extension, and allows you
to record, edit, and replay the test in firefox
Selenium IDE allows you to save tests as HTML, Java,
Ruby scripts, or any other format
It allows you to automatically add assertions to all the
pages.
Allows you to add selenese commands as and when
required
Selence
●

●

Selence special test scripting language for
Selenium.
Selenese provides commands for performing
actions in a browser (click a link, select an
option), and for retrieving data from the
resulting pages.
Selenium IDE Installation
●

First download Mozilla Firefox browser.

●

Click on the Firefox tab present at the top the browser window.

●

In drop down menu click on Add-on.

●

Go to add on page of Mozilla Firefox browser

●

In the search box of Add on page search the term "Selenium IDE" and
press enter

●

Click on more link to the Selenium IDE add-on

●

Go to http://docs.seleniumhq.org/download/

●

Once installation is done the Mozilla Firefox browser will ask you to
restart the browser.Just Restart it.
Selenium IDE - UI
Start and Stop
Recording

Replay
Toolbar

Editor

Accessor
Area

Selenese
Script
Editor

Selenium Log
Recoding a Selenium Test Case
●
●
●
●

●

●

Open Firefox that has the IDE installed
Open the base URL of the application to record.
Keep the application in a common base state.
Go To Tools  Selenium IDE and the IDE will be
opened
Now perform the operations on the application as you
are testing the application.
Once you are done with the recording click on the stop
recording button and save the test case through the file
menu. By default it will be saved as a selenese script
(HTML format)
Creating a Test Suite
●

●

In the Selenium IDE you can
create any number of test
cases and save them as test
suite.
To Run the test Suite click on
the “Play entire test suite”
button as shown below.

Test Suite with
Test1 & test2
Running Options
Run a Test Case
Click the Run button to run the currently displayed test case.

Run a Test Suite
Click the Run All button to run all the test cases in the currently loaded test
suite.

Stop and Start
The Pause button can be used to stop the test case while it is running. The
icon of this button then changes to indicate the Resume button. To
continue click Resume.
Adding Assertions to the Script
●

Selenese allows multiple ways of checking for UI
elements.

●

Verifications and assertions are used to check if

●

an element is present somewhere on the page?

●

specific text is somewhere on the page?

●

specific text is at a specific location on the page?

●

Verifications and assertions are not one and the same.

●

If an assertion fails, the script will be aborted but if a
verification fails the script will continue.
Assertion Statements
●

●

●

●

●

assertTextPresent
This will assert if the text is present in the page.
assertText
This will assert if a particular element is having the particular text.
assertTitle
This will assert if the page is having a proper title.
assertValue
This will assert if a Text box or check box has a particular value
assertElementPresent
This will assert if a particular UI Element is present in the page.
User Acceptance Testing (UAT)
●

●

●

User Acceptance Testing (UAT) is the last phase of the software
testing process. During UAT, actual software users test the
software to make sure it can handle required tasks in real world
scenarios, according to specifications.
UAT is one of the final and critical software project procedures
that must occur before newly developed software is rolled out to
the market.
UAT is also known as beta testing, application testing or end
user testing.
Steps Involved in In-House UAT
●

●

●

●

●

Planning: The UAT strategy is outlined during the planning step.
Designing test cases: Test cases are designed to cover all the
functional scenarios of the software in real-world usage.
Executing test cases and documenting: The testing team executes the
designed test cases. All bugs are logged in a testing document with
relevant comments.
Bug fixing: Responding to the bugs found by the testing team, the
software development team makes final adjustments to the code to
make the software bug-free.
Sign-off: When all bugs have been fixed, the testing team indicates
acceptance of the software application. This shows that the application
meets user requirements and is ready to be rolled out in the market.
Importance of UAT
●

●

UAT is important because it helps demonstrate that required
business functions are operating in a manner suited to realworld circumstances and usage.
UAT is an effective process with a high rate of return for those
who take the time to implement and follow its discipline.
How Selenium Work
Common Problem in Web Testing
●

Record/replay is not reusable, is fragile.

●

Managing test cases.

●

UI changesmake tests brittle.
ScalaTest Using Selenium
●

●

ScalaTest 2.0 includes a domain specific language (DSL) for writing
browser-based tests using Selenium.
To use ScalaTest's Selenium DSL, you'll first need to add Selenium to
your project dependencies. For example, in your sbt build you might
add:
libraryDependencies += "org.seleniumhq.selenium" % "seleniumjava" % "2.23.1" % "test->default"

●

Mix trait WebBrowser into your test class.This trait provides the DSL
in its entirety except for one missing piece : an implicit
org.openqa.selenium.WebDriver
Element Locator
●

ID: id=foo

●

Name: name=foo

●

First ID, then name: identifier=foo

●

DOM: document.forms[‘myform’].myDropdown

●

XPath: xpath=//table[@id='table1']//tr[4]/td[2]

●

Link Text: link=sometext

●

CSS Selector: css=a[href=“#id3”]

●

Sensible defaults, e.g. xpath if starts with //
Example of UAT
class BlogSpec extends FlatSpec with ShouldMatchers with
WebBrowser {
implicit val webDriver: WebDriver = new HtmlUnitDriver
val host = "http://localhost:9000/"
"The blog app home page" should "have the correct title" in {
go to (host + "index.html")
pageTitle should be ("Awesome Blog")
}
}
Terms of Test Cases
●

Navigation:
You can ask the browser to retrieve a page (go to a URL) like this:
go to "http://www.artima.com"

●

Checking input element values:
textField("q").value should be ("Cheese!")
textArea("body").value should be ("I saw something cool today!")

●

Implicit wait :
implicitlyWait(Span(10, Seconds))

●

Cleaning up:
To close all windows, and exit the driver, use quit:
quit()
Test Code of Autocomplete
Functionality
●

Define the autocomplete test code in a trait so that it will be use by all the test class which extends this trait :
trait Reattempt {
def attemptOrReattempAutoComplete(func: By => WebElement, selector: String, searchText: String,Text: String, startWithCount:
Int, maxNumberOfRetries: Int = 5): Unit = {
if (startWithCount <= maxNumberOfRetries && searchText.length > 0) {
func(By.cssSelector(selector)).clear
func(By.cssSelector(selector)).sendKeys(searchText)
try {
if(searchText == Text) {
func(By.cssSelector(“refrence of div where this search text element present")).click
} else {
func(By.cssSelector("refrence of div where this search text element presen")).sendKeys(Keys.ARROW_UP)
}
} catch {
case e: TimeoutException => attemptOrReattempAutoComplete(func, selector, searchText.substring(0, searchText.length 1),Text: String, startWithCount + 1, maxNumberOfRetries)
case e: ElementNotVisibleException => attemptOrReattempAutoComplete(func, selector, searchText.substring(0,
searchText.length - 1), Text: String, startWithCount + 1, maxNumberOfRetries)
}
}
}
}
Sequentially Running Test
To run the whole test cases sequentially we
have to put this line in build.sbt
“parallelExecution in Test := false
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)
parallelExecution in ScctPlugin.ScctTest := false”
Command For Run Acceptace Test
●

To run single test
sbt “test-only packageName.className”

●

To run whole test
sbt test

●

To check the coverage report
sbt scct:test
Selenium Test in Headless Mode
with Xvfb
●

➢

Follow the following steps to configure Xvfb
(Virtual Framebuffer) to run test cases:
install Xvfb on ubuntu using following
command :
sudo apt-get install xvfb

➢

Create .sh file in root /etc/init.d/ folder and
paste the following script code in the script (.sh)
file:
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 +extension GLX +render -noreset -nolisten tcp"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
echo -n "Stopping virtual X frame buffer: Xvfb"
start-stop-daemon --stop --quiet --pidfile $PIDFILE
echo "."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/xvfb {start|stop|restart}"
exit 1
esac

exit 0
Selenium Test in Headless Mode
with Xvfb
●

Now,open the terminal and go to your project
and run :
Xvfb :1 -screen 0 1920x1080x24 +extension
GLX +render -noreset -nolisten tcp

●

and open another tab of terminal and go to your
project and run :
export DISPLAY=:1
sbt test
Thank You

Contenu connexe

Tendances

Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsSauce Labs
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and SeleniumKarapet Sarkisyan
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Mehdi Khalili
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - IntroductionAmr E. Mohamed
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersHaitham Refaat
 
Test automation - Building effective solutions
Test automation - Building effective solutionsTest automation - Building effective solutions
Test automation - Building effective solutionsArtem Nagornyi
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 
Selenium ide material (1)
Selenium ide material (1)Selenium ide material (1)
Selenium ide material (1)Sriram Angajala
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverPankaj Biswas
 
selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...Nancy Thomas
 

Tendances (20)

Mobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason HugginsMobile Testing with Selenium 2 by Jason Huggins
Mobile Testing with Selenium 2 by Jason Huggins
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium presentation
Selenium presentationSelenium presentation
Selenium presentation
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
 
Test automation - Building effective solutions
Test automation - Building effective solutionsTest automation - Building effective solutions
Test automation - Building effective solutions
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium ide material (1)
Selenium ide material (1)Selenium ide material (1)
Selenium ide material (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium IDE LOCATORS
Selenium IDE LOCATORSSelenium IDE LOCATORS
Selenium IDE LOCATORS
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 
selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...
 

En vedette

Scaladays 2014 introduction to scalatest selenium dsl
Scaladays 2014   introduction to scalatest selenium dslScaladays 2014   introduction to scalatest selenium dsl
Scaladays 2014 introduction to scalatest selenium dslMatthew Farwell
 
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagiosMonitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagiosLindsay Holmwood
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsQUONTRASOLUTIONS
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniumshreyas JC
 
Selenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce LabsSelenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce LabsSauce Labs
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideMek Srunyu Stittri
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics TutorialClever Moe
 

En vedette (15)

Scaladays 2014 introduction to scalatest selenium dsl
Scaladays 2014   introduction to scalatest selenium dslScaladays 2014   introduction to scalatest selenium dsl
Scaladays 2014 introduction to scalatest selenium dsl
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Monitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagiosMonitoring web application behaviour with cucumber-nagios
Monitoring web application behaviour with cucumber-nagios
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra Solutions
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce LabsSelenium and Appium Training from Sauce Labs
Selenium and Appium Training from Sauce Labs
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year later
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Basics Tutorial
Selenium Basics TutorialSelenium Basics Tutorial
Selenium Basics Tutorial
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 

Similaire à Integrating Selenium testing infrastructure into Scala Project

Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to SeleniumKnoldus Inc.
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Selenium
SeleniumSelenium
Seleniumnil65
 
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVEN
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVENAUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVEN
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVENSHASHI JAISWAL
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfMinh Quân Đoàn
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4Knoldus Inc.
 
Automation Testing with Test Complete
Automation Testing with Test CompleteAutomation Testing with Test Complete
Automation Testing with Test CompleteVartika Saxena
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Aravindharamanan S
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)Wael Mansour
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniummindqqa
 

Similaire à Integrating Selenium testing infrastructure into Scala Project (20)

Introduction to Selenium
Introduction to SeleniumIntroduction to Selenium
Introduction to Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
What is selenium
What is seleniumWhat is selenium
What is selenium
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Selenium
SeleniumSelenium
Selenium
 
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVEN
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVENAUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVEN
AUTOMATION FRAMEWORK USING SELENIUM & TESTNG ALONG WITH MAVEN
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
 
Quality for developers
Quality for developersQuality for developers
Quality for developers
 
Selenium (1) (1)
Selenium (1) (1)Selenium (1) (1)
Selenium (1) (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Automation Testing with Test Complete
Automation Testing with Test CompleteAutomation Testing with Test Complete
Automation Testing with Test Complete
 
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
Softwaretestingtoolsfreeandopensourcefinal 150411221750-conversion-gate01
 
Software testing tools (free and open source)
Software testing tools (free and open source)Software testing tools (free and open source)
Software testing tools (free and open source)
 
Wso2con test-automation
Wso2con test-automationWso2con test-automation
Wso2con test-automation
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 

Plus de Knoldus Inc.

Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxKnoldus Inc.
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxKnoldus Inc.
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxKnoldus Inc.
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxKnoldus Inc.
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationKnoldus Inc.
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationKnoldus Inc.
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIsKnoldus Inc.
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II PresentationKnoldus Inc.
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAKnoldus Inc.
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Knoldus Inc.
 
Azure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxAzure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxKnoldus Inc.
 
The Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinThe Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinKnoldus Inc.
 
Data Engineering with Databricks Presentation
Data Engineering with Databricks PresentationData Engineering with Databricks Presentation
Data Engineering with Databricks PresentationKnoldus Inc.
 
Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Knoldus Inc.
 
NoOps - (Automate Ops) Presentation.pptx
NoOps - (Automate Ops) Presentation.pptxNoOps - (Automate Ops) Presentation.pptx
NoOps - (Automate Ops) Presentation.pptxKnoldus Inc.
 
Mastering Distributed Performance Testing
Mastering Distributed Performance TestingMastering Distributed Performance Testing
Mastering Distributed Performance TestingKnoldus Inc.
 
MLops on Vertex AI Presentation (AI/ML).pptx
MLops on Vertex AI Presentation (AI/ML).pptxMLops on Vertex AI Presentation (AI/ML).pptx
MLops on Vertex AI Presentation (AI/ML).pptxKnoldus Inc.
 
Introduction to Ansible Tower Presentation
Introduction to Ansible Tower PresentationIntroduction to Ansible Tower Presentation
Introduction to Ansible Tower PresentationKnoldus Inc.
 
CQRS with dot net services presentation.
CQRS with dot net services presentation.CQRS with dot net services presentation.
CQRS with dot net services presentation.Knoldus Inc.
 

Plus de Knoldus Inc. (20)

Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 
Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)Advanced Python (with dependency injection and hydra configuration packages)
Advanced Python (with dependency injection and hydra configuration packages)
 
Azure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptxAzure Databricks (For Data Analytics).pptx
Azure Databricks (For Data Analytics).pptx
 
The Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and KotlinThe Power of Dependency Injection with Dagger 2 and Kotlin
The Power of Dependency Injection with Dagger 2 and Kotlin
 
Data Engineering with Databricks Presentation
Data Engineering with Databricks PresentationData Engineering with Databricks Presentation
Data Engineering with Databricks Presentation
 
Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)Databricks for MLOps Presentation (AI/ML)
Databricks for MLOps Presentation (AI/ML)
 
NoOps - (Automate Ops) Presentation.pptx
NoOps - (Automate Ops) Presentation.pptxNoOps - (Automate Ops) Presentation.pptx
NoOps - (Automate Ops) Presentation.pptx
 
Mastering Distributed Performance Testing
Mastering Distributed Performance TestingMastering Distributed Performance Testing
Mastering Distributed Performance Testing
 
MLops on Vertex AI Presentation (AI/ML).pptx
MLops on Vertex AI Presentation (AI/ML).pptxMLops on Vertex AI Presentation (AI/ML).pptx
MLops on Vertex AI Presentation (AI/ML).pptx
 
Introduction to Ansible Tower Presentation
Introduction to Ansible Tower PresentationIntroduction to Ansible Tower Presentation
Introduction to Ansible Tower Presentation
 
CQRS with dot net services presentation.
CQRS with dot net services presentation.CQRS with dot net services presentation.
CQRS with dot net services presentation.
 

Dernier

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Dernier (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

Integrating Selenium testing infrastructure into Scala Project

  • 2. History of The Selenium ● ● Selenium is invent by Jason Huggins He developed a Javascript library that could drive interactions with the page, allowing him to automatically rerun tests against multiple browsers.
  • 3. Test Automation ● Test automation is the use of software To set test preconditions. To control the execution of tests. To compare the actual outcomes to predicted outcomes. To report the Execution Status. ● Commonly, test automation involves automating a manual process already in place that uses a formalized testing process.
  • 4. Why and When To Automate? Frequent regression testing ● Repeated test case Execution is required ● User Acceptance Tests ● Faster Feedback to the developers ● Reduce the Human Effort ● Test same application on multiple environments ●
  • 5. Selenium ● ● ● Selenium is a robust set of tools that supports rapid development of test automation for web-based applications. Selenium provides a rich set of testing functions specifically geared to the needs of testing of a web application. Selenium operations are highly flexible, allowing many options for locating UI elements and comparing expected test results against actual application behavior.
  • 6. Selenium Features ● ● ● ● ● ● Supports Cross Browser Testing. The Selenium tests can be run on multiple browsers. Allows scripting in several languages like Java, C#, PHP and Python. Ajax/CSS support. Assertion statements provide an efficient way of comparing expected and actual results. Inbuilt reporting mechanism. Selenium is an open source tool
  • 7. Selenium Components ● Selenium IDE ● Selenium Remote Control ● Selenium Grid
  • 8. Selenium IDE ● ● ● ● ● ● Previously known as Selenium Recorder Selenium IDE is an integrated development environment for Selenium tests. It is implemented as a Firefox extension, and allows you to record, edit, and replay the test in firefox Selenium IDE allows you to save tests as HTML, Java, Ruby scripts, or any other format It allows you to automatically add assertions to all the pages. Allows you to add selenese commands as and when required
  • 9. Selence ● ● Selence special test scripting language for Selenium. Selenese provides commands for performing actions in a browser (click a link, select an option), and for retrieving data from the resulting pages.
  • 10. Selenium IDE Installation ● First download Mozilla Firefox browser. ● Click on the Firefox tab present at the top the browser window. ● In drop down menu click on Add-on. ● Go to add on page of Mozilla Firefox browser ● In the search box of Add on page search the term "Selenium IDE" and press enter ● Click on more link to the Selenium IDE add-on ● Go to http://docs.seleniumhq.org/download/ ● Once installation is done the Mozilla Firefox browser will ask you to restart the browser.Just Restart it.
  • 11. Selenium IDE - UI Start and Stop Recording Replay Toolbar Editor Accessor Area Selenese Script Editor Selenium Log
  • 12. Recoding a Selenium Test Case ● ● ● ● ● ● Open Firefox that has the IDE installed Open the base URL of the application to record. Keep the application in a common base state. Go To Tools  Selenium IDE and the IDE will be opened Now perform the operations on the application as you are testing the application. Once you are done with the recording click on the stop recording button and save the test case through the file menu. By default it will be saved as a selenese script (HTML format)
  • 13. Creating a Test Suite ● ● In the Selenium IDE you can create any number of test cases and save them as test suite. To Run the test Suite click on the “Play entire test suite” button as shown below. Test Suite with Test1 & test2
  • 14. Running Options Run a Test Case Click the Run button to run the currently displayed test case. Run a Test Suite Click the Run All button to run all the test cases in the currently loaded test suite. Stop and Start The Pause button can be used to stop the test case while it is running. The icon of this button then changes to indicate the Resume button. To continue click Resume.
  • 15. Adding Assertions to the Script ● Selenese allows multiple ways of checking for UI elements. ● Verifications and assertions are used to check if ● an element is present somewhere on the page? ● specific text is somewhere on the page? ● specific text is at a specific location on the page? ● Verifications and assertions are not one and the same. ● If an assertion fails, the script will be aborted but if a verification fails the script will continue.
  • 16. Assertion Statements ● ● ● ● ● assertTextPresent This will assert if the text is present in the page. assertText This will assert if a particular element is having the particular text. assertTitle This will assert if the page is having a proper title. assertValue This will assert if a Text box or check box has a particular value assertElementPresent This will assert if a particular UI Element is present in the page.
  • 17. User Acceptance Testing (UAT) ● ● ● User Acceptance Testing (UAT) is the last phase of the software testing process. During UAT, actual software users test the software to make sure it can handle required tasks in real world scenarios, according to specifications. UAT is one of the final and critical software project procedures that must occur before newly developed software is rolled out to the market. UAT is also known as beta testing, application testing or end user testing.
  • 18. Steps Involved in In-House UAT ● ● ● ● ● Planning: The UAT strategy is outlined during the planning step. Designing test cases: Test cases are designed to cover all the functional scenarios of the software in real-world usage. Executing test cases and documenting: The testing team executes the designed test cases. All bugs are logged in a testing document with relevant comments. Bug fixing: Responding to the bugs found by the testing team, the software development team makes final adjustments to the code to make the software bug-free. Sign-off: When all bugs have been fixed, the testing team indicates acceptance of the software application. This shows that the application meets user requirements and is ready to be rolled out in the market.
  • 19. Importance of UAT ● ● UAT is important because it helps demonstrate that required business functions are operating in a manner suited to realworld circumstances and usage. UAT is an effective process with a high rate of return for those who take the time to implement and follow its discipline.
  • 21. Common Problem in Web Testing ● Record/replay is not reusable, is fragile. ● Managing test cases. ● UI changesmake tests brittle.
  • 22. ScalaTest Using Selenium ● ● ScalaTest 2.0 includes a domain specific language (DSL) for writing browser-based tests using Selenium. To use ScalaTest's Selenium DSL, you'll first need to add Selenium to your project dependencies. For example, in your sbt build you might add: libraryDependencies += "org.seleniumhq.selenium" % "seleniumjava" % "2.23.1" % "test->default" ● Mix trait WebBrowser into your test class.This trait provides the DSL in its entirety except for one missing piece : an implicit org.openqa.selenium.WebDriver
  • 23. Element Locator ● ID: id=foo ● Name: name=foo ● First ID, then name: identifier=foo ● DOM: document.forms[‘myform’].myDropdown ● XPath: xpath=//table[@id='table1']//tr[4]/td[2] ● Link Text: link=sometext ● CSS Selector: css=a[href=“#id3”] ● Sensible defaults, e.g. xpath if starts with //
  • 24. Example of UAT class BlogSpec extends FlatSpec with ShouldMatchers with WebBrowser { implicit val webDriver: WebDriver = new HtmlUnitDriver val host = "http://localhost:9000/" "The blog app home page" should "have the correct title" in { go to (host + "index.html") pageTitle should be ("Awesome Blog") } }
  • 25. Terms of Test Cases ● Navigation: You can ask the browser to retrieve a page (go to a URL) like this: go to "http://www.artima.com" ● Checking input element values: textField("q").value should be ("Cheese!") textArea("body").value should be ("I saw something cool today!") ● Implicit wait : implicitlyWait(Span(10, Seconds)) ● Cleaning up: To close all windows, and exit the driver, use quit: quit()
  • 26. Test Code of Autocomplete Functionality ● Define the autocomplete test code in a trait so that it will be use by all the test class which extends this trait : trait Reattempt { def attemptOrReattempAutoComplete(func: By => WebElement, selector: String, searchText: String,Text: String, startWithCount: Int, maxNumberOfRetries: Int = 5): Unit = { if (startWithCount <= maxNumberOfRetries && searchText.length > 0) { func(By.cssSelector(selector)).clear func(By.cssSelector(selector)).sendKeys(searchText) try { if(searchText == Text) { func(By.cssSelector(“refrence of div where this search text element present")).click } else { func(By.cssSelector("refrence of div where this search text element presen")).sendKeys(Keys.ARROW_UP) } } catch { case e: TimeoutException => attemptOrReattempAutoComplete(func, selector, searchText.substring(0, searchText.length 1),Text: String, startWithCount + 1, maxNumberOfRetries) case e: ElementNotVisibleException => attemptOrReattempAutoComplete(func, selector, searchText.substring(0, searchText.length - 1), Text: String, startWithCount + 1, maxNumberOfRetries) } } } }
  • 27. Sequentially Running Test To run the whole test cases sequentially we have to put this line in build.sbt “parallelExecution in Test := false concurrentRestrictions in Global += Tags.limit(Tags.Test, 1) parallelExecution in ScctPlugin.ScctTest := false”
  • 28. Command For Run Acceptace Test ● To run single test sbt “test-only packageName.className” ● To run whole test sbt test ● To check the coverage report sbt scct:test
  • 29. Selenium Test in Headless Mode with Xvfb ● ➢ Follow the following steps to configure Xvfb (Virtual Framebuffer) to run test cases: install Xvfb on ubuntu using following command : sudo apt-get install xvfb ➢ Create .sh file in root /etc/init.d/ folder and paste the following script code in the script (.sh) file:
  • 30. XVFB=/usr/bin/Xvfb XVFBARGS=":1 -screen 0 1024x768x24 +extension GLX +render -noreset -nolisten tcp" PIDFILE=/var/run/xvfb.pid case "$1" in start) echo -n "Starting virtual X frame buffer: Xvfb" start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS echo "." ;; stop) echo -n "Stopping virtual X frame buffer: Xvfb" start-stop-daemon --stop --quiet --pidfile $PIDFILE echo "." ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/xvfb {start|stop|restart}" exit 1 esac exit 0
  • 31. Selenium Test in Headless Mode with Xvfb ● Now,open the terminal and go to your project and run : Xvfb :1 -screen 0 1920x1080x24 +extension GLX +render -noreset -nolisten tcp ● and open another tab of terminal and go to your project and run : export DISPLAY=:1 sbt test