SlideShare a Scribd company logo
1
Useful practices of creation
automatic tests by using
Cucumber-JVM
Shapin Anton
November 19, 2016
2
• Lead Software Test Automation Engineer
• 9+ years in IT
• Areas of my competency: manual,
automation, performance and etc.
• Successfully completed 9 BDD projects.
• 1 BDD projects in progress.
Email: anton_shapin@epam.com
Skype: anton_shapin
GIT: http://github.com/kirlionik
Shapin Anton
3
Agenda
BDD approach(3 small slides)1
Best Practices2
Parallel mode3
Questions4
4
LET`S START !
5
BDD approach
BDD(behavior-driven development) - is a set of software engineering practices
designed to help teams build and deliver more valuable, higher quality software faster. It
draws on Agile and lean practices including, in particular, Test-Driven Development (TDD) and
Domain-Driven Design (DDD).
BDD isn’t a software development methodology in its own right. It’s not a replacement
for Scrum, XP, Kanban, RUP, or whatever methodology you’re currently using.
MAIN GOAL: EXECUTABLE SPECIFICATION
6
How it works
@Given("^I perform Quick Search by "([^"]*)" $")
public void i_perform_quick_search_by(String query) {
driver.findElement(By.id(“searchQuery”)).sendKeys(query);
driver.findElement(By.id(“submit”)).click();
}
Scenario: Running a Full Text Quick Search.
Given I perform Quick Search by "IPhone 4S"
...
Each step maps to Java Method
File *.feature
File *.class
Example of GUI Scenario
Scenario: Running a Full Text Quick Search.
Given I perform Quick Search by "IPhone 4S"
When I click on link 'Search History' on panel 'Quick Search'
Then the term query "IPhone 4S" should be the first in the Search
History grid
8
The main layers of a Cucumber test suite
9
Why I like BDD:
Test logic is in total independent
layer of implementation.
1
All test cases and automated
tests are up to date.
2
BA could accept user-story base
on test execution report.
3
Manual or Junior qa
automation engineers help
me develop automated tests.
4
Example of Web Service
IP Address Geolocation XML API
The API returns the location of an IP address (country, region, city, zip code, latitude, longitude) and the associated
time zone in XML format.
Usage:
For country precision (faster), do a query with the following API :
IPv4 Address
http://localhost.com/v5/ip-country/?key=<your_api_key>&ipv4=74.125.45.100
IPv6 Address
http://localhost.com/v5/ip-country/?key=<your_api_key>&ipv6=2001:0200:0102::
http://localhost.com/v4/ip-city/?key=<your_api_key>&ip=74.125.45.100
For city precision, do a query with the following API (if you omit the IP parameter it will check with your own IP) :
Best Practices. Test Step Creation.
Create template of steps:
WHEN:
• I set the …
• I send request to …
• I add …
Then:
• I get … .
• the report should contain ...
• the values of the ...
WHEN:
• I set the key as «12Gth6Ntds»
• I send request to Geo City
• I add the ip «74.125.45.100»
Then:
• I get http status as "200"
• the report should contain country «USA»
This will help find existing steps and creating a new steps
Best Practices. Test Step Creation.
This will help to find the existing steps and
do not make a mistake in the name of the parameter
Name of parameter must not be a variable
@When("^I set the key as "([^"]*)" $")
public void i_set_key(int number) {
// TODO: code goes here
}
@When("^I set the "([^"]*)" as "([^"]*)" $")
public void i_set_param(String name, int number) {
// TODO: code goes here
}
Given I set the “key” as “12Gth6Ntds”
Given I set the “ip” as “74.125.45.100” Given I set the key as “12Gth6Ntds”
BAD GOOD
Best Practices. Test Step Creation.
This will help understand function of steps
Create Javadoc before each Step definition methods
Best Practices. Test Step Creation.
User Helpers. For example IntelliJ IDEA plugin «Cucumber for Java»
15
Best Practices. Test Step Creation.
1. Separating the Support Code
2. Favorite way to organize step definition files is to organize
them with one file per domain entity: GeoCityStepDef.class,
GeoCountryStepDef.class.
3. By default Cucumber find StepDef classes in the same
package as *.feature files.
Organizing the Code
Best Practices. Test Step Creation.
This will help you get more understandable tests reports
Use cucumber plugins for reporting.
@CucumberOptions(
strict = true,
plugin = {
"com.github.kirlionik.cucumberallure.AllureReporter",
"pretty", "json:target/Cucumber.json",
"html:target/cucumber-html-report"
}
)
You can develop your own Cucumber plugins.
Best Practices. Test Step Creation.
Use cucumber plugins for reporting.
com.github.kirlionik.cucumberallure.AllureReporter
@SeverityLevel.CRITICAL @TestCaseId("geo-0001") @Issue(“geo-1006")
Scenario: Check city by ipv4
Given I set the key as "asd-asd-asd"
And I set the ip as "123.123.123.123"
When I send request to Geo City
Then I get http status as "200"
And the report should contain country "USA"
And the report should contain city "New York"
You can:
• Define Severity of each scenario.
• Create link to issue.
• Link to user-story.
• Create attachments.
• Other Allure Core features …
This will help you get more understandable tests reports
Best Practices. Test Step Creation.
Use cucumber plugins for reporting.
com.github.kirlionik.cucumberallure.AllureReporter
Best Practices. Test Step Creation.
public class Container {
public GeoServiceOutput output;
public String key;
public String ip;
}
All steps in Cucumber are independent.
This will help you develop automated tests and
use complex architecture of tests system.
Use class “Container” for transfer data between stepDef
methods and classes.
Best Practices.
Feel free to use parallel mode for test execution.
This will reduce tests execution time.
For example. How to:
• Create several “runner” classes with name “*ParallelIT.class”
• Define tags of features in each “runner” class.
You shouldn`t have the same tags in different “runner”
classes.
• Add profile into pom.xml file:
• Add parameters in Configuration section of “maven-failsafe-
plugin”:
• For execute tests run command:
mvn clean install -Pparallel
<profile>
<id>parallel</id>
<properties>
<junit.threadCount>4</junit.threadCount>
<junit.parallel>classes</junit.parallel>
<run.classes>**/*ParallelIT.class</run.classes>
</properties>
</profile>
<reuseForks>false</reuseForks>
<forkCount>20</forkCount>
<threadCount>${junit.threadCount}</threadCount>
<parallel>${junit.parallel}</parallel>
In my current project I reduced execution time from 30 min to 10 min
Best Practices.
You can transfer to Java StepDef method complex objects.
….
Then the report should have the next formatting:
| text | color | font | size | bold | type |
| Country | Black | Arial | 28 | true | NORMAL |
| Ip address | RED | Calibri | 20 | false | NORMAL |
@Then("^the report should have the next formatting$")
public void check_the_report_style(List<StyledText> styledTextsList) {
// TODO: code goes here
}
public class StyledText {
private String text;
private String color;
private String font;
private Integer size;
private boolean bold;
private String type;
}
Cucumber create objects of StyledText automatically.
22
Summary
1. Create Javadoc before each Step definition methods.
2. Create template of steps.
3. Name of parameter must not be a variable.
4. Use cucumber plugins for reporting.
5. Very carefully think through the architecture of your test
system (What? Where? Why? How?).
23
Conclusion
1. BDD is a very good approach. But this is not a magic bullet.
2. Most difficult things in BDD are create good test system
architecture and define «Rules of the game»
3. To use or not to use BDD depends on situation and project.
24
Thank you for attention!
Email: anton_shapin@epam.com
Skype: anton_shapin
GIT: http://github.com/kirlionik

More Related Content

What's hot

Git hooks
Git hooksGit hooks
Git hooks
Skills Matter
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jaran Flaath
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
Md.Mojibul Hoque
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
Guo Albert
 
Sql ppt
Sql pptSql ppt
Sql ppt
Anuja Lad
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
Ajit Jadhav
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
Vincent Kok
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
Edureka!
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
akbarashaikh
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
Lushanthan Sivaneasharajah
 
Demantra12
Demantra12Demantra12
Demantra12
ggangad09
 
Let'Swift 2023 Swift Macro, 어디다 쓰죠?
Let'Swift 2023 Swift Macro, 어디다 쓰죠?Let'Swift 2023 Swift Macro, 어디다 쓰죠?
Let'Swift 2023 Swift Macro, 어디다 쓰죠?
williciousk
 
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
QADay
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
Muhammad Hafiz Hasan
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
CodeOps Technologies LLP
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot
 
Triggers in SQL | Edureka
Triggers in SQL | EdurekaTriggers in SQL | Edureka
Triggers in SQL | Edureka
Edureka!
 

What's hot (20)

Git hooks
Git hooksGit hooks
Git hooks
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Java Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By StepJava Persistence API (JPA) Step By Step
Java Persistence API (JPA) Step By Step
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Connecting Connect with Spring Boot
Connecting Connect with Spring BootConnecting Connect with Spring Boot
Connecting Connect with Spring Boot
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
Getting started with entity framework
Getting started with entity framework Getting started with entity framework
Getting started with entity framework
 
Demantra12
Demantra12Demantra12
Demantra12
 
Let'Swift 2023 Swift Macro, 어디다 쓰죠?
Let'Swift 2023 Swift Macro, 어디다 쓰죠?Let'Swift 2023 Swift Macro, 어디다 쓰죠?
Let'Swift 2023 Swift Macro, 어디다 쓰죠?
 
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
АНАСТАСІЯ РУСОВА «Побудова якості в команді без тестувальників – міф чи реаль...
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
 
An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Triggers in SQL | Edureka
Triggers in SQL | EdurekaTriggers in SQL | Edureka
Triggers in SQL | Edureka
 

Similar to Useful practices of creation automatic tests by using cucumber jvm

Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
EatDog
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Evgeniy Kuzmin
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
Nalin Goonawardana
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
Evgeniy Kuzmin
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
Yan Cui
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
Yan Cui
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Fabio Franzini
 
Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)
Yan Cui
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
Matt Callanan
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
Yan Cui
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Ortus Solutions, Corp
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)
Yan Cui
 
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
Craeg Strong
 
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
Craeg Strong
 
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)
Yan Cui
 
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMPInria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Stéphanie Roger
 
Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)
Yan Cui
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)
Yan Cui
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
Gil Fink
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
wajrcs
 

Similar to Useful practices of creation automatic tests by using cucumber jvm (20)

Continuous integration / continuous delivery
Continuous integration / continuous deliveryContinuous integration / continuous delivery
Continuous integration / continuous delivery
 
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
Continuous integration / continuous delivery of web applications, Eugen Kuzmi...
 
Behavior Driven Development by Example
Behavior Driven Development by ExampleBehavior Driven Development by Example
Behavior Driven Development by Example
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)Serverless in production, an experience report (LNUG)
Serverless in production, an experience report (LNUG)
 
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
20211202 North America DevOps Group NADOG Adapting to Covid With Serverless C...
 
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
20211202 NADOG Adapting to Covid with Serverless Craeg Strong Ariel Partners
 
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)
 
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMPInria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
 
Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)
 
Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)Serverless in Production, an experience report (cloudXchange)
Serverless in Production, an experience report (cloudXchange)
 
Quick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmineQuick tour to front end unit testing using jasmine
Quick tour to front end unit testing using jasmine
 
Continuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CIContinuous Delivery - Automate & Build Better Software with Travis CI
Continuous Delivery - Automate & Build Better Software with Travis CI
 

Recently uploaded

Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 

Recently uploaded (20)

Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 

Useful practices of creation automatic tests by using cucumber jvm

  • 1. 1 Useful practices of creation automatic tests by using Cucumber-JVM Shapin Anton November 19, 2016
  • 2. 2 • Lead Software Test Automation Engineer • 9+ years in IT • Areas of my competency: manual, automation, performance and etc. • Successfully completed 9 BDD projects. • 1 BDD projects in progress. Email: anton_shapin@epam.com Skype: anton_shapin GIT: http://github.com/kirlionik Shapin Anton
  • 3. 3 Agenda BDD approach(3 small slides)1 Best Practices2 Parallel mode3 Questions4
  • 5. 5 BDD approach BDD(behavior-driven development) - is a set of software engineering practices designed to help teams build and deliver more valuable, higher quality software faster. It draws on Agile and lean practices including, in particular, Test-Driven Development (TDD) and Domain-Driven Design (DDD). BDD isn’t a software development methodology in its own right. It’s not a replacement for Scrum, XP, Kanban, RUP, or whatever methodology you’re currently using. MAIN GOAL: EXECUTABLE SPECIFICATION
  • 6. 6 How it works @Given("^I perform Quick Search by "([^"]*)" $") public void i_perform_quick_search_by(String query) { driver.findElement(By.id(“searchQuery”)).sendKeys(query); driver.findElement(By.id(“submit”)).click(); } Scenario: Running a Full Text Quick Search. Given I perform Quick Search by "IPhone 4S" ... Each step maps to Java Method File *.feature File *.class
  • 7. Example of GUI Scenario Scenario: Running a Full Text Quick Search. Given I perform Quick Search by "IPhone 4S" When I click on link 'Search History' on panel 'Quick Search' Then the term query "IPhone 4S" should be the first in the Search History grid
  • 8. 8 The main layers of a Cucumber test suite
  • 9. 9 Why I like BDD: Test logic is in total independent layer of implementation. 1 All test cases and automated tests are up to date. 2 BA could accept user-story base on test execution report. 3 Manual or Junior qa automation engineers help me develop automated tests. 4
  • 10. Example of Web Service IP Address Geolocation XML API The API returns the location of an IP address (country, region, city, zip code, latitude, longitude) and the associated time zone in XML format. Usage: For country precision (faster), do a query with the following API : IPv4 Address http://localhost.com/v5/ip-country/?key=<your_api_key>&ipv4=74.125.45.100 IPv6 Address http://localhost.com/v5/ip-country/?key=<your_api_key>&ipv6=2001:0200:0102:: http://localhost.com/v4/ip-city/?key=<your_api_key>&ip=74.125.45.100 For city precision, do a query with the following API (if you omit the IP parameter it will check with your own IP) :
  • 11. Best Practices. Test Step Creation. Create template of steps: WHEN: • I set the … • I send request to … • I add … Then: • I get … . • the report should contain ... • the values of the ... WHEN: • I set the key as «12Gth6Ntds» • I send request to Geo City • I add the ip «74.125.45.100» Then: • I get http status as "200" • the report should contain country «USA» This will help find existing steps and creating a new steps
  • 12. Best Practices. Test Step Creation. This will help to find the existing steps and do not make a mistake in the name of the parameter Name of parameter must not be a variable @When("^I set the key as "([^"]*)" $") public void i_set_key(int number) { // TODO: code goes here } @When("^I set the "([^"]*)" as "([^"]*)" $") public void i_set_param(String name, int number) { // TODO: code goes here } Given I set the “key” as “12Gth6Ntds” Given I set the “ip” as “74.125.45.100” Given I set the key as “12Gth6Ntds” BAD GOOD
  • 13. Best Practices. Test Step Creation. This will help understand function of steps Create Javadoc before each Step definition methods
  • 14. Best Practices. Test Step Creation. User Helpers. For example IntelliJ IDEA plugin «Cucumber for Java»
  • 15. 15 Best Practices. Test Step Creation. 1. Separating the Support Code 2. Favorite way to organize step definition files is to organize them with one file per domain entity: GeoCityStepDef.class, GeoCountryStepDef.class. 3. By default Cucumber find StepDef classes in the same package as *.feature files. Organizing the Code
  • 16. Best Practices. Test Step Creation. This will help you get more understandable tests reports Use cucumber plugins for reporting. @CucumberOptions( strict = true, plugin = { "com.github.kirlionik.cucumberallure.AllureReporter", "pretty", "json:target/Cucumber.json", "html:target/cucumber-html-report" } ) You can develop your own Cucumber plugins.
  • 17. Best Practices. Test Step Creation. Use cucumber plugins for reporting. com.github.kirlionik.cucumberallure.AllureReporter @SeverityLevel.CRITICAL @TestCaseId("geo-0001") @Issue(“geo-1006") Scenario: Check city by ipv4 Given I set the key as "asd-asd-asd" And I set the ip as "123.123.123.123" When I send request to Geo City Then I get http status as "200" And the report should contain country "USA" And the report should contain city "New York" You can: • Define Severity of each scenario. • Create link to issue. • Link to user-story. • Create attachments. • Other Allure Core features … This will help you get more understandable tests reports
  • 18. Best Practices. Test Step Creation. Use cucumber plugins for reporting. com.github.kirlionik.cucumberallure.AllureReporter
  • 19. Best Practices. Test Step Creation. public class Container { public GeoServiceOutput output; public String key; public String ip; } All steps in Cucumber are independent. This will help you develop automated tests and use complex architecture of tests system. Use class “Container” for transfer data between stepDef methods and classes.
  • 20. Best Practices. Feel free to use parallel mode for test execution. This will reduce tests execution time. For example. How to: • Create several “runner” classes with name “*ParallelIT.class” • Define tags of features in each “runner” class. You shouldn`t have the same tags in different “runner” classes. • Add profile into pom.xml file: • Add parameters in Configuration section of “maven-failsafe- plugin”: • For execute tests run command: mvn clean install -Pparallel <profile> <id>parallel</id> <properties> <junit.threadCount>4</junit.threadCount> <junit.parallel>classes</junit.parallel> <run.classes>**/*ParallelIT.class</run.classes> </properties> </profile> <reuseForks>false</reuseForks> <forkCount>20</forkCount> <threadCount>${junit.threadCount}</threadCount> <parallel>${junit.parallel}</parallel> In my current project I reduced execution time from 30 min to 10 min
  • 21. Best Practices. You can transfer to Java StepDef method complex objects. …. Then the report should have the next formatting: | text | color | font | size | bold | type | | Country | Black | Arial | 28 | true | NORMAL | | Ip address | RED | Calibri | 20 | false | NORMAL | @Then("^the report should have the next formatting$") public void check_the_report_style(List<StyledText> styledTextsList) { // TODO: code goes here } public class StyledText { private String text; private String color; private String font; private Integer size; private boolean bold; private String type; } Cucumber create objects of StyledText automatically.
  • 22. 22 Summary 1. Create Javadoc before each Step definition methods. 2. Create template of steps. 3. Name of parameter must not be a variable. 4. Use cucumber plugins for reporting. 5. Very carefully think through the architecture of your test system (What? Where? Why? How?).
  • 23. 23 Conclusion 1. BDD is a very good approach. But this is not a magic bullet. 2. Most difficult things in BDD are create good test system architecture and define «Rules of the game» 3. To use or not to use BDD depends on situation and project.
  • 24. 24 Thank you for attention! Email: anton_shapin@epam.com Skype: anton_shapin GIT: http://github.com/kirlionik

Editor's Notes

  1. .