SlideShare a Scribd company logo
1 of 41
Download to read offline
Continuous Test Automation
Richard Langlois P. Eng. and Yuri Pechenko, May 2018
Agenda
• What is Continuous Testing
• Maven Recap
• Unit Testing
• Integration Testing
• Functional Testing
• Acceptance Testing
2
Software Testing Levels
3
• SOFTWARE TESTING LEVELS are the different stages of the software development lifecycle where testing is conducted.
• There are four levels of software testing: Unit >> Integration >> System >> Acceptance.
Continuous Testing
Continuous Testing is the process of executing automated tests as part of the software delivery pipeline in order to obtain
feedback on the business risks associated with a software release candidate as rapidly as possible.
4
Maven Recap
• Maven divides execution into the following nested hierarchies:
• Lifecycle,
• Phase,
• Plugin,
• Goal
5
Maven Recap
Lifecycle
• A Build Lifecycle is a well defined sequence of phases which define the order in which the goals are to be executed.
• Lifecycle allows to execute multiple Goals sequentially.
• Maven ships with three lifecycles:
• Clean
• Default
• Site
6
Maven Recap
Phases
• When executing a phase, all phases and bound plugin goals up to that point in the lifecycle are also executed.
• Each step in a lifecycle flow is called a phase.
7
Maven Recap
Plugin
• A plugin is a logical grouping and distribution (often a single JAR) of related goals, such as JARing.
8
Maven Recap
Goal
• A goal, the most granular step in Maven, is a single executable task within a plugin.
• Zero or more plugin goals are bound to a phase.
9
Unit Testing
10
• A level of the software testing process where individual units of a software are tested.
• The purpose is to validate that each unit of the software performs as designed.
Unit Testing
Maven – Dependencies
<junit5-version>5.1.1</junit5-version>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5-version}</version>
<scope>test</scope>
</dependency>
11
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit5-version}</version>
</dependency>
OR
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
Unit Testing
Surefire Plugin
Surefire plugin runs unit tests during the test phase.
12
Unit Testing
Maven Test Lifecycle
Use Maven Surefire Plugin by calling the test phase of the build lifecycle:
13
Unit Testing
Maven Surefire Plugin – Dependency:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</build>
14
Unit Testing
XML/TXT Reports
The Surefire plugin generates reports in two different file formats:
● Plain text files (*.txt)
● XML files (*.xml)
By default, these files are generated in ${basedir}/target/surefire-reports/TEST-*.xml.
To generate .txt/.xml reports:
mvn site
15
Unit Testing
HTML Reports with Surefire Report Plugin
The Surefire Report Plugin
• parses the generated TEST-*.xml files under ${basedir}/target/surefire-reports
• creates the web interface version of the test results in ${basedir}/target/site/surefire-report.html folder
Goals:
● surefire-report:report Generates the test results report into HTML format.
● surefire-report:report-only This goal does not run the tests, it only builds the reports.
16
Unit Testing
Surefire Report
Dependency:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</reporting>
17
Unit Testing
HTML Report
Sample of a report:
18
Unit Testing
HTML Report with Jenkins
The Jenkins JUnit plugin:
• provides a publisher that consumes XML test reports generated during the builds
• provides some graphical visualization of the historical test results
• provides a web UI for viewing test reports, tracking failures.
• JUnit publisher is configured at the job level by adding a Publish JUnit test result report post build action.
19
Integration Testing
20
• A level of the software testing process where individual units are combined and tested as a group.
• The purpose of this level of testing is to expose faults in the interaction between integrated units.
Integration Testing
Maven
• Default Lifecycle Phases for running integration test:
• pre-integration-test: sets up the integration test environment.
• integration-test: runs the integration tests.
• post-integration-test: tears down the integration test environment.
• Verify: checks the results of the integration tests.
Failsafe Plugin is designed to run integration tests, while the Surefire Plugin is designed to run unit tests.
The Failsafe Plugin has 2 goals:
● failsafe:integration-test:
• runs the integration tests of an application
● failsafe:verify
• verifies that the integration tests of an application passed
21
Integration Testing
Maven Failsafe Plugin
• Use Maven Failsafe Plugin by calling the verify phase of the build lifecycle:
22
Integration Testing
Maven structure:
In the source folder, we have an extra directory called "it", with its usual java and resources folder.
23
Failsafe Plugin
Integration Testing
By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns:
• "**/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT".
• "**/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT".
• "**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase".
To specify test sources folder other than the default:
• Configure Failsafe plugin with includes, excludes attribute
• Configure build-helper-maven-plugin with sources attribute
24
Failsafe Plugin
Integration Testing
Failsafe Plugin uses the exact same format as the Surefire Plugin.
To generate a report, just add a second Surefire Report Plugin report set using the Failsafe reports directory, and run:
mvn site
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.21.0</version>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
25
Reports
Integration Testing
Jenkins
stage('Test'){
steps{
bat 'mvn test'
}
}
26
New maven job: mvn verify or mvn integration-test
Artifact: Jenkinsfile
stage('Verify'){
steps{
bat 'mvn verify'
}
}
Functional Testing
27
SYSTEM TESTING is a level of software testing where a
complete and integrated software is tested.
The purpose of this test is to evaluate the system’s
compliance with the specified requirements.
ACCEPTANCE TESTING is a level of software testing
where a system is tested for acceptability.
The purpose of this test is to evaluate the system’s
compliance with the business requirements and assess
whether it is acceptable for delivery.
Functional Testing
28
List of Checks (Test Cases)
Test Framework (TestNG vs JUnit)
Test Scope (Chrome, Internet
Explorer, FireFox etc.)
Selenium driver (Selenuim)
Alithya Digital Solutions Center : using JUnit(4 or 5) + Selenium
Functional Testing
Selenium
• Selenium is a portable software-testing framework for web applications
29
Functional Testing
Maven - Dependencies for Selenium
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.11.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
30
Functional Testing
Web Driver Manager
The Web Driver Manager is a library that is aimed to automate the Selenium WebDriver binaries management in runtime for Java.
System.setProperty("webdriver.chrome.driver", "/absolute/path/to/binary/chromedriver");
System.setProperty("webdriver.gecko.driver", "/absolute/path/to/binary/geckodriver");
System.setProperty("webdriver.opera.driver", "/absolute/path/to/binary/operadriver");
System.setProperty("phantomjs.binary.path", "/absolute/path/to/binary/phantomjs");
System.setProperty("webdriver.edge.driver", "C:/absolute/path/to/binary/MicrosoftWebDriver.exe");
System.setProperty("webdriver.ie.driver", "C:/absolute/path/to/binary/IEDriverServer.exe");
WebDriverManager comes to the rescue, performing in an automated way all this dirty job for you.
● it downloads the necessary binary
● it checks for the latest version each time
● it is fully configurable
31
Maven - Dependencies for Webdriver Manager
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>2.2.1</version>
<scope>test</scope>
</dependency>
If using JUnit 5, add:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>selenium-jupiter</artifactId>
<version>2.1.1</version>
</dependency>
32
Functional Testing
Implementation
Page object model: every page -> separate java class
Access page elements (buttons, checkboxes, fields etc.) with css and xpath selectors.
Application Oracle Selenium Demo
33
Functional Testing
Automation Test Approach Data Driven (DDD)
Test Scenario:
1. Open Login Page
2. Login
3. Open Saisie Adhérents page
4. Select random employee group
5. Create a new employee line
6. Fill in a new employee
7. Check created line for importing
8. Click addEmployeeButton
9. Verify that the employee was added to the system.
34
Functional Testing
Reporting
• <dependency>
• <groupId>com.aventstack</groupId>
• <artifactId>extentreports</artifactId>
• <version>3.1.5</version>
• <scope>test</scope>
• </dependency>
35
Extent Report Demo
Acceptance Testing
• Cucumber (Java) supports Behavior Driven Development (BDD) – Specflow (C#)
• It explains the behavior of the application in a simple English text using Gherkin language.
• Scenarios are part of tests
36
Automation Test Approach Behavior-Driven
Acceptance Testing
Cucumber
37
Acceptance Testing
In the test runner, the @CucumberOptions offers plugin option to specify different formatting options for the output reports.
The following example will generate a Json report at the mentioned location:
@RunWith(Cucumber.class)
@CucumberOptions(features = {"src/test/java/features/Feature01.feature"},
format = {"json:target/cucumber.json"},
glue = "tests.employees")
public class CucumberRunner {
//empty class for linking Feature class and java class
Json report -> HTML report with Maven-Cucumber-Reporting plugin
38
Reports
Acceptance Testing
Maven Dependencies
<cucumber-version>2.4.0</cucumber.version>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber-version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber-version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>${cucumber-version}</version>
</dependency>
39
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>3.16.0</version>
<executions>
<execution>
<id>execution</id>
<phase>post-integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>${project.name}</projectName>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Acceptance Testing
40
Jenkinsfile
• The simplest way to get Cucumber report in Jenkins is to Install cucumber-reports-plugin for Jenkins which takes json
report file of cucumber report and returns pretty html report.
• After installation of the plugin a method cucumber(params…) will be available for pipeline usage.
• cucumber '**/*.json‘
Jenkins file:
post{
always{
cucumber '**/*.json'
}
}
Cucumber automation example
References
• Software Testing Fundamentals (http://softwaretestingfundamentals.com)
• Cucumber Home (https://cucumber.io)
• Using a Jenkinsfile (https://jenkins.io/doc/book/pipeline/jenkinsfile)
• Declarative Pipeline with Jenkins (https://dzone.com/storage/assets/6132886-dzone-rc241-declarativepipelinewithjenkins-
2.pdf)
41

More Related Content

What's hot

Using Jenkins and Jmeter to build a scalable Load Testing solution
Using Jenkins and Jmeter to build a scalable Load Testing solutionUsing Jenkins and Jmeter to build a scalable Load Testing solution
Using Jenkins and Jmeter to build a scalable Load Testing solutionRuslan Strazhnyk
 
JMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaJMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaEdureka!
 
R12 d49656 gc10-apps dba 19
R12 d49656 gc10-apps dba 19R12 d49656 gc10-apps dba 19
R12 d49656 gc10-apps dba 19zeesniper
 
"Introduction to JMeter" @ CPTM 3rd Session
"Introduction to JMeter" @ CPTM 3rd Session"Introduction to JMeter" @ CPTM 3rd Session
"Introduction to JMeter" @ CPTM 3rd SessionTharinda Liyanage
 
Introduction to JMeter
Introduction to JMeterIntroduction to JMeter
Introduction to JMeterGalih Lasahido
 
R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27zeesniper
 
Performance testing with Apache JMeter
Performance testing with Apache JMeterPerformance testing with Apache JMeter
Performance testing with Apache JMeterRedBlackTree
 
Performance testing using hp load runner
Performance testing using hp load runnerPerformance testing using hp load runner
Performance testing using hp load runnerReturn on Intelligence
 
O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...Satya Harish
 
Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeterjvSlideshare
 
Automation - Apache JMeter
Automation - Apache JMeterAutomation - Apache JMeter
Automation - Apache JMeterWira Santos
 
Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs JmeterAtul Pant
 

What's hot (19)

Using Jenkins and Jmeter to build a scalable Load Testing solution
Using Jenkins and Jmeter to build a scalable Load Testing solutionUsing Jenkins and Jmeter to build a scalable Load Testing solution
Using Jenkins and Jmeter to build a scalable Load Testing solution
 
JMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaJMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | Edureka
 
R12 d49656 gc10-apps dba 19
R12 d49656 gc10-apps dba 19R12 d49656 gc10-apps dba 19
R12 d49656 gc10-apps dba 19
 
"Introduction to JMeter" @ CPTM 3rd Session
"Introduction to JMeter" @ CPTM 3rd Session"Introduction to JMeter" @ CPTM 3rd Session
"Introduction to JMeter" @ CPTM 3rd Session
 
Introduction to JMeter
Introduction to JMeterIntroduction to JMeter
Introduction to JMeter
 
JMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar pptJMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar ppt
 
R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27R12 d49656 gc10-apps dba 27
R12 d49656 gc10-apps dba 27
 
Meteor
MeteorMeteor
Meteor
 
Performance testing with Apache JMeter
Performance testing with Apache JMeterPerformance testing with Apache JMeter
Performance testing with Apache JMeter
 
LoadRunner walkthrough
LoadRunner walkthroughLoadRunner walkthrough
LoadRunner walkthrough
 
Prometheus workshop
Prometheus workshopPrometheus workshop
Prometheus workshop
 
Performance testing using hp load runner
Performance testing using hp load runnerPerformance testing using hp load runner
Performance testing using hp load runner
 
About QTP 9.2
About QTP 9.2About QTP 9.2
About QTP 9.2
 
Apache jMeter
Apache jMeterApache jMeter
Apache jMeter
 
O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...O - Oracle application testing suite test starter kits for oracle e business ...
O - Oracle application testing suite test starter kits for oracle e business ...
 
Performance testing and reporting with JMeter
Performance testing and reporting with JMeterPerformance testing and reporting with JMeter
Performance testing and reporting with JMeter
 
Automation - Apache JMeter
Automation - Apache JMeterAutomation - Apache JMeter
Automation - Apache JMeter
 
Loadrunner vs Jmeter
Loadrunner vs JmeterLoadrunner vs Jmeter
Loadrunner vs Jmeter
 
J Meter Intro
J Meter IntroJ Meter Intro
J Meter Intro
 

Similar to Continuous Test Automation: Unit, Integration, Functional and Acceptance Testing

Automated Testing on Web Applications
Automated Testing on Web ApplicationsAutomated Testing on Web Applications
Automated Testing on Web ApplicationsSamuel Borg
 
Software Testing Strategies ,Validation Testing and System Testing.
Software Testing Strategies ,Validation Testing and System Testing.Software Testing Strategies ,Validation Testing and System Testing.
Software Testing Strategies ,Validation Testing and System Testing.Tanzeem Aslam
 
Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5Boni García
 
Introduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsIntroduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsSISTechnologies
 
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
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5hemasubbu08
 
Qa case study
Qa case studyQa case study
Qa case studyhopperdev
 
The QA/Testing Process
The QA/Testing ProcessThe QA/Testing Process
The QA/Testing ProcessSynerzip
 
03 test specification and execution
03   test specification and execution03   test specification and execution
03 test specification and executionClemens Reijnen
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudCarlos Sanchez
 
How to fit Performance Testing in Devops environment.pptx.pdf
How to fit Performance Testing in Devops environment.pptx.pdfHow to fit Performance Testing in Devops environment.pptx.pdf
How to fit Performance Testing in Devops environment.pptx.pdfKnoldus Inc.
 

Similar to Continuous Test Automation: Unit, Integration, Functional and Acceptance Testing (20)

Maven advanced
Maven advancedMaven advanced
Maven advanced
 
Automated Testing on Web Applications
Automated Testing on Web ApplicationsAutomated Testing on Web Applications
Automated Testing on Web Applications
 
Test ng for testers
Test ng for testersTest ng for testers
Test ng for testers
 
Software Testing Strategies ,Validation Testing and System Testing.
Software Testing Strategies ,Validation Testing and System Testing.Software Testing Strategies ,Validation Testing and System Testing.
Software Testing Strategies ,Validation Testing and System Testing.
 
Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5
 
Introduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOpsIntroduction to Maven for beginners and DevOps
Introduction to Maven for beginners and DevOps
 
Maven
MavenMaven
Maven
 
Sel
SelSel
Sel
 
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
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
 
Qa case study
Qa case studyQa case study
Qa case study
 
software engineering
software engineeringsoftware engineering
software engineering
 
CH-3.pdf
CH-3.pdfCH-3.pdf
CH-3.pdf
 
The QA/Testing Process
The QA/Testing ProcessThe QA/Testing Process
The QA/Testing Process
 
03 test specification and execution
03   test specification and execution03   test specification and execution
03 test specification and execution
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Enterprise Build And Test In The Cloud
Enterprise Build And Test In The CloudEnterprise Build And Test In The Cloud
Enterprise Build And Test In The Cloud
 
How to fit Performance Testing in Devops environment.pptx.pdf
How to fit Performance Testing in Devops environment.pptx.pdfHow to fit Performance Testing in Devops environment.pptx.pdf
How to fit Performance Testing in Devops environment.pptx.pdf
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
 
Testing In Java4278
Testing In Java4278Testing In Java4278
Testing In Java4278
 

More from Richard Langlois P. Eng.

More from Richard Langlois P. Eng. (6)

Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.Microservice Architecture Patterns, by Richard Langlois P. Eng.
Microservice Architecture Patterns, by Richard Langlois P. Eng.
 
Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5Reactive Programming in Java and Spring Framework 5
Reactive Programming in Java and Spring Framework 5
 
What's New in Java 9
What's New in Java 9What's New in Java 9
What's New in Java 9
 
DevOps, Yet Another IT Revolution
DevOps, Yet Another IT RevolutionDevOps, Yet Another IT Revolution
DevOps, Yet Another IT Revolution
 
What is new in JUnit5
What is new in JUnit5What is new in JUnit5
What is new in JUnit5
 
Introduction to Reactive Microservices Architecture.
Introduction to Reactive Microservices Architecture.Introduction to Reactive Microservices Architecture.
Introduction to Reactive Microservices Architecture.
 

Recently uploaded

SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 

Recently uploaded (20)

SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 

Continuous Test Automation: Unit, Integration, Functional and Acceptance Testing

  • 1. Continuous Test Automation Richard Langlois P. Eng. and Yuri Pechenko, May 2018
  • 2. Agenda • What is Continuous Testing • Maven Recap • Unit Testing • Integration Testing • Functional Testing • Acceptance Testing 2
  • 3. Software Testing Levels 3 • SOFTWARE TESTING LEVELS are the different stages of the software development lifecycle where testing is conducted. • There are four levels of software testing: Unit >> Integration >> System >> Acceptance.
  • 4. Continuous Testing Continuous Testing is the process of executing automated tests as part of the software delivery pipeline in order to obtain feedback on the business risks associated with a software release candidate as rapidly as possible. 4
  • 5. Maven Recap • Maven divides execution into the following nested hierarchies: • Lifecycle, • Phase, • Plugin, • Goal 5
  • 6. Maven Recap Lifecycle • A Build Lifecycle is a well defined sequence of phases which define the order in which the goals are to be executed. • Lifecycle allows to execute multiple Goals sequentially. • Maven ships with three lifecycles: • Clean • Default • Site 6
  • 7. Maven Recap Phases • When executing a phase, all phases and bound plugin goals up to that point in the lifecycle are also executed. • Each step in a lifecycle flow is called a phase. 7
  • 8. Maven Recap Plugin • A plugin is a logical grouping and distribution (often a single JAR) of related goals, such as JARing. 8
  • 9. Maven Recap Goal • A goal, the most granular step in Maven, is a single executable task within a plugin. • Zero or more plugin goals are bound to a phase. 9
  • 10. Unit Testing 10 • A level of the software testing process where individual units of a software are tested. • The purpose is to validate that each unit of the software performs as designed.
  • 11. Unit Testing Maven – Dependencies <junit5-version>5.1.1</junit5-version> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <version>1.1.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>${junit5-version}</version> <scope>test</scope> </dependency> 11 <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>${junit5-version}</version> </dependency> OR <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency>
  • 12. Unit Testing Surefire Plugin Surefire plugin runs unit tests during the test phase. 12
  • 13. Unit Testing Maven Test Lifecycle Use Maven Surefire Plugin by calling the test phase of the build lifecycle: 13
  • 14. Unit Testing Maven Surefire Plugin – Dependency: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.21.0</version> </plugin> </plugins> </build> 14
  • 15. Unit Testing XML/TXT Reports The Surefire plugin generates reports in two different file formats: ● Plain text files (*.txt) ● XML files (*.xml) By default, these files are generated in ${basedir}/target/surefire-reports/TEST-*.xml. To generate .txt/.xml reports: mvn site 15
  • 16. Unit Testing HTML Reports with Surefire Report Plugin The Surefire Report Plugin • parses the generated TEST-*.xml files under ${basedir}/target/surefire-reports • creates the web interface version of the test results in ${basedir}/target/site/surefire-report.html folder Goals: ● surefire-report:report Generates the test results report into HTML format. ● surefire-report:report-only This goal does not run the tests, it only builds the reports. 16
  • 19. Unit Testing HTML Report with Jenkins The Jenkins JUnit plugin: • provides a publisher that consumes XML test reports generated during the builds • provides some graphical visualization of the historical test results • provides a web UI for viewing test reports, tracking failures. • JUnit publisher is configured at the job level by adding a Publish JUnit test result report post build action. 19
  • 20. Integration Testing 20 • A level of the software testing process where individual units are combined and tested as a group. • The purpose of this level of testing is to expose faults in the interaction between integrated units.
  • 21. Integration Testing Maven • Default Lifecycle Phases for running integration test: • pre-integration-test: sets up the integration test environment. • integration-test: runs the integration tests. • post-integration-test: tears down the integration test environment. • Verify: checks the results of the integration tests. Failsafe Plugin is designed to run integration tests, while the Surefire Plugin is designed to run unit tests. The Failsafe Plugin has 2 goals: ● failsafe:integration-test: • runs the integration tests of an application ● failsafe:verify • verifies that the integration tests of an application passed 21
  • 22. Integration Testing Maven Failsafe Plugin • Use Maven Failsafe Plugin by calling the verify phase of the build lifecycle: 22
  • 23. Integration Testing Maven structure: In the source folder, we have an extra directory called "it", with its usual java and resources folder. 23 Failsafe Plugin
  • 24. Integration Testing By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns: • "**/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT". • "**/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT". • "**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase". To specify test sources folder other than the default: • Configure Failsafe plugin with includes, excludes attribute • Configure build-helper-maven-plugin with sources attribute 24 Failsafe Plugin
  • 25. Integration Testing Failsafe Plugin uses the exact same format as the Surefire Plugin. To generate a report, just add a second Surefire Report Plugin report set using the Failsafe reports directory, and run: mvn site <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.21.0</version> <reportSets> <reportSet> <id>integration-tests</id> <reports> <report>failsafe-report-only</report> </reports> </reportSet> </reportSets> </plugin> 25 Reports
  • 26. Integration Testing Jenkins stage('Test'){ steps{ bat 'mvn test' } } 26 New maven job: mvn verify or mvn integration-test Artifact: Jenkinsfile stage('Verify'){ steps{ bat 'mvn verify' } }
  • 27. Functional Testing 27 SYSTEM TESTING is a level of software testing where a complete and integrated software is tested. The purpose of this test is to evaluate the system’s compliance with the specified requirements. ACCEPTANCE TESTING is a level of software testing where a system is tested for acceptability. The purpose of this test is to evaluate the system’s compliance with the business requirements and assess whether it is acceptable for delivery.
  • 28. Functional Testing 28 List of Checks (Test Cases) Test Framework (TestNG vs JUnit) Test Scope (Chrome, Internet Explorer, FireFox etc.) Selenium driver (Selenuim) Alithya Digital Solutions Center : using JUnit(4 or 5) + Selenium
  • 29. Functional Testing Selenium • Selenium is a portable software-testing framework for web applications 29
  • 30. Functional Testing Maven - Dependencies for Selenium <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.11.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> 30
  • 31. Functional Testing Web Driver Manager The Web Driver Manager is a library that is aimed to automate the Selenium WebDriver binaries management in runtime for Java. System.setProperty("webdriver.chrome.driver", "/absolute/path/to/binary/chromedriver"); System.setProperty("webdriver.gecko.driver", "/absolute/path/to/binary/geckodriver"); System.setProperty("webdriver.opera.driver", "/absolute/path/to/binary/operadriver"); System.setProperty("phantomjs.binary.path", "/absolute/path/to/binary/phantomjs"); System.setProperty("webdriver.edge.driver", "C:/absolute/path/to/binary/MicrosoftWebDriver.exe"); System.setProperty("webdriver.ie.driver", "C:/absolute/path/to/binary/IEDriverServer.exe"); WebDriverManager comes to the rescue, performing in an automated way all this dirty job for you. ● it downloads the necessary binary ● it checks for the latest version each time ● it is fully configurable 31
  • 32. Maven - Dependencies for Webdriver Manager <dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>webdrivermanager</artifactId> <version>2.2.1</version> <scope>test</scope> </dependency> If using JUnit 5, add: <dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>selenium-jupiter</artifactId> <version>2.1.1</version> </dependency> 32
  • 33. Functional Testing Implementation Page object model: every page -> separate java class Access page elements (buttons, checkboxes, fields etc.) with css and xpath selectors. Application Oracle Selenium Demo 33
  • 34. Functional Testing Automation Test Approach Data Driven (DDD) Test Scenario: 1. Open Login Page 2. Login 3. Open Saisie Adhérents page 4. Select random employee group 5. Create a new employee line 6. Fill in a new employee 7. Check created line for importing 8. Click addEmployeeButton 9. Verify that the employee was added to the system. 34
  • 35. Functional Testing Reporting • <dependency> • <groupId>com.aventstack</groupId> • <artifactId>extentreports</artifactId> • <version>3.1.5</version> • <scope>test</scope> • </dependency> 35 Extent Report Demo
  • 36. Acceptance Testing • Cucumber (Java) supports Behavior Driven Development (BDD) – Specflow (C#) • It explains the behavior of the application in a simple English text using Gherkin language. • Scenarios are part of tests 36 Automation Test Approach Behavior-Driven
  • 38. Acceptance Testing In the test runner, the @CucumberOptions offers plugin option to specify different formatting options for the output reports. The following example will generate a Json report at the mentioned location: @RunWith(Cucumber.class) @CucumberOptions(features = {"src/test/java/features/Feature01.feature"}, format = {"json:target/cucumber.json"}, glue = "tests.employees") public class CucumberRunner { //empty class for linking Feature class and java class Json report -> HTML report with Maven-Cucumber-Reporting plugin 38 Reports
  • 39. Acceptance Testing Maven Dependencies <cucumber-version>2.4.0</cucumber.version> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java</artifactId> <version>${cucumber-version}</version> </dependency> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java8</artifactId> <version>${cucumber-version}</version> </dependency> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java8</artifactId> <version>${cucumber-version}</version> </dependency> 39 <plugin> <groupId>net.masterthought</groupId> <artifactId>maven-cucumber-reporting</artifactId> <version>3.16.0</version> <executions> <execution> <id>execution</id> <phase>post-integration-test</phase> <goals> <goal>generate</goal> </goals> <configuration> <projectName>${project.name}</projectName> <outputDirectory>${project.build.directory}</outputDirectory> </configuration> </execution> </executions> </plugin>
  • 40. Acceptance Testing 40 Jenkinsfile • The simplest way to get Cucumber report in Jenkins is to Install cucumber-reports-plugin for Jenkins which takes json report file of cucumber report and returns pretty html report. • After installation of the plugin a method cucumber(params…) will be available for pipeline usage. • cucumber '**/*.json‘ Jenkins file: post{ always{ cucumber '**/*.json' } } Cucumber automation example
  • 41. References • Software Testing Fundamentals (http://softwaretestingfundamentals.com) • Cucumber Home (https://cucumber.io) • Using a Jenkinsfile (https://jenkins.io/doc/book/pipeline/jenkinsfile) • Declarative Pipeline with Jenkins (https://dzone.com/storage/assets/6132886-dzone-rc241-declarativepipelinewithjenkins- 2.pdf) 41