SlideShare a Scribd company logo
My Test Automation Journey
2015 Vera Djakova & Vaidas Pilkauskas
Agenda
● How to make a big mess
● And then clean the campground
● Using Driver Pattern
My experience
New Life
Let’s start!
● Dream team
● Dream tools
○ Selenium
○ Java
○ Maven
Even
requirement
to use IE is
OK
So I have started!
After three months...
//Add new document, click button "New"
click (//button[contains(@value, 'New')]);
Thread.sleep(2000);
//Check new form
shouldHaveText("New document");
//Click button "Add" and check errors
click("//button[contains(@value, 'Add')]");
Thread.sleep(1000);
shouldHaveText(labelFromProperties("document.properties", "document.message.document-name-empty"));
//Type document name, select type, add activation date
insert("//input[contains(@name, 'name')]", "doc_1");
selectById("//select[contains(@name, 'type')]", 1);
insert("//input[contains(@name, 'start-date')]", "2015-10-15");
//Click button "Add"
click("//button[contains(@value, 'Add')]");
//Check new document
Thread.sleep(5000);
shouldHaveText(labelFromProperties("document.properties", "document.message.successfully-add"));
shouldHaveText("doc_1");
Complicated test logic
xpath
// Click button "Yes"
click(".//body/table/dir/dir[6]/button[2]");
Technical debt
Manual dependencies
Help me
• Static analysis (Sonar) -> refactoring
• sleep -> wait
Help me vol2
• Project build structure
• Page Object
My Test Automation Journey
Driver pattern in tests
Testing REST APIs
What is an API?
{
“item”: “flower”
}
{
“status”: “accepted”
}
@Test shouldRetrieveUserByLogin() {
String userJson = "{"username": "vaidas"}";
HttpRequest post = new Post("https://localhost:8080/users", userJson);
HttpResponse postResp = HttpClient().execute(post);
assertThat(postResp.status, is(200));
HttpRequest get = new Get("https://localhost:8080/users/vaidas");
HttpResponse getResp = HttpClient().execute(get);
User user = mapper.readValue(getResp, User.class);
assertThat(username, is("vaidas"));
}
Few problems with such test
● Business requirements are mixed
within implementation
● URLs are hardcoded
● Payload format is hardcoded
● Test exposes use of HTTP protocol
Improved version
@Test shouldRetrieveUserByUsername() {
givenUserExists("vaidas");
GetUserResponse getResp = usersDriver.aGetUserRequest()
.withUsername("vaidas").execute();
assertThat(getResp, allOf(hasStatus(OK), hasUsername("vaidas")));
}
Driver pattern
● Abstracts implementation from business logic
● Removes duplication
● Test specification becomes reusable
So, what if there’s a need to...
● Add another protocol (http + https)
● Another input format
● Test with different configuration
● Customize for different clients
InternetBankApiTest extends BankApiTest
with InternetBankDriver
with InternetBankApiMatchers
AtmApiTest extends BankApiTest
with AtmDriver
with AtmMatchers
Depending on your programming language:
● Use inheritance or composition
● Java 8 has default method in interfaces
● Consider using another language - JavaScript, Groovy,
Scala, etc
What if there is difference
between two implementations?
● Override tests by extending the contract class
● Use class hierarchy to group tests into
reusable test suites
Page Object pattern
● Is a variant of Driver pattern
● Selenium best practice
● encapsulates selector logic
● Solves the same problem as using drivers with
API testing
● Does not have to be per page, but per
component
Test patterns summary
● Use Driver Pattern for Microservice/API
● Use Page Object for graphical interface
My Test Automation Journey
Lessons learnt
• Testers should not work separately from
programmers
• Quality matters
• Allocate time to maintain tests
• Or later it will cost €
Summary
● Do more pairing
● Treat automation as a craft
● Regular feedback is a must
Thanks!
Q&A

More Related Content

PPT
Gems Of Selenium
PPTX
Marcin Wasilczyk - Page objects with selenium
PDF
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
PDF
Easy automation.py
PDF
Selenium - The page object pattern
PDF
Сергей Больщиков "Protractor Tips & Tricks"
PDF
Easy tests with Selenide and Easyb
PDF
Webdriver cheatsheets summary
Gems Of Selenium
Marcin Wasilczyk - Page objects with selenium
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Easy automation.py
Selenium - The page object pattern
Сергей Больщиков "Protractor Tips & Tricks"
Easy tests with Selenide and Easyb
Webdriver cheatsheets summary

What's hot (20)

KEY
Jellyfish, JSCONF 2011
PPT
Testing in AngularJS
PDF
Unit-testing and E2E testing in JS
PDF
Polyglot automation - QA Fest - 2015
PDF
Automated Testing in Angular Slides
PPTX
Better Page Object Handling with Loadable Component Pattern
PDF
Automation Abstraction Layers: Page Objects and Beyond
PPTX
Testing React Applications
PPTX
Automation testing with Drupal 8
PDF
Page object pattern
PDF
Introducing Playwright's New Test Runner
PPTX
Protractor framework – how to make stable e2e tests for Angular applications
PDF
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
PDF
Page Object Model and Implementation in Selenium
PDF
Kiss PageObjects [01-2017]
PDF
Jest: Frontend Testing leicht gemacht @EnterJS2018
ODP
Nexthink Library - replacing a ruby on rails application with Scala and Spray
PDF
Integration testing - A&BP CC
PPTX
Selenium withnet
PPTX
Behavior Driven Development Testing (BDD)
Jellyfish, JSCONF 2011
Testing in AngularJS
Unit-testing and E2E testing in JS
Polyglot automation - QA Fest - 2015
Automated Testing in Angular Slides
Better Page Object Handling with Loadable Component Pattern
Automation Abstraction Layers: Page Objects and Beyond
Testing React Applications
Automation testing with Drupal 8
Page object pattern
Introducing Playwright's New Test Runner
Protractor framework – how to make stable e2e tests for Angular applications
Hands on Exploration of Page Objects and Abstraction Layers with Selenium Web...
Page Object Model and Implementation in Selenium
Kiss PageObjects [01-2017]
Jest: Frontend Testing leicht gemacht @EnterJS2018
Nexthink Library - replacing a ruby on rails application with Scala and Spray
Integration testing - A&BP CC
Selenium withnet
Behavior Driven Development Testing (BDD)
Ad

Similar to My Test Automation Journey (20)

PDF
Playwright Testing Guide for QA Engineers.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Selenium Online Training.pdf
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
Gatling Performance Workshop
ODP
Integrating Selenium testing infrastructure into Scala Project
PDF
Test all the things! Automated testing with Drupal 8
ODP
2014 11 20 Drupal 7 -> 8 test migratie
PDF
Strategy-driven Test Generation with Open Source Frameworks
PDF
Testing Tools Online Training.pdf
ODP
Unit Testing and Coverage for AngularJS
PPT
Test Automation Framework Development Introduction
PDF
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
PPTX
Frontend training
PDF
3 WAYS TO TEST YOUR COLDFUSION API -
PDF
3 WAYS TO TEST YOUR COLDFUSION API
PDF
Test automation - Building effective solutions
Playwright Testing Guide for QA Engineers.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Selenium Online Training.pdf
Test and Behaviour Driven Development (TDD/BDD)
Gatling Performance Workshop
Integrating Selenium testing infrastructure into Scala Project
Test all the things! Automated testing with Drupal 8
2014 11 20 Drupal 7 -> 8 test migratie
Strategy-driven Test Generation with Open Source Frameworks
Testing Tools Online Training.pdf
Unit Testing and Coverage for AngularJS
Test Automation Framework Development Introduction
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Frontend training
3 WAYS TO TEST YOUR COLDFUSION API -
3 WAYS TO TEST YOUR COLDFUSION API
Test automation - Building effective solutions
Ad

More from Vaidas Pilkauskas (6)

PDF
Hiring Backend Engineers
PDF
Understanding Mocks
PDF
Coderetreat introduction
PDF
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
PDF
Can you trust your tests?
PDF
Developer Tests - Things to Know
Hiring Backend Engineers
Understanding Mocks
Coderetreat introduction
Can You Trust Your Tests? (Agile Tour 2015 Kaunas)
Can you trust your tests?
Developer Tests - Things to Know

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KodekX | Application Modernization Development
Building Integrated photovoltaic BIPV_UPV.pdf
A Presentation on Artificial Intelligence
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

My Test Automation Journey

  • 1. My Test Automation Journey 2015 Vera Djakova & Vaidas Pilkauskas
  • 2. Agenda ● How to make a big mess ● And then clean the campground ● Using Driver Pattern
  • 5. Let’s start! ● Dream team ● Dream tools ○ Selenium ○ Java ○ Maven
  • 7. So I have started!
  • 9. //Add new document, click button "New" click (//button[contains(@value, 'New')]); Thread.sleep(2000); //Check new form shouldHaveText("New document"); //Click button "Add" and check errors click("//button[contains(@value, 'Add')]"); Thread.sleep(1000); shouldHaveText(labelFromProperties("document.properties", "document.message.document-name-empty")); //Type document name, select type, add activation date insert("//input[contains(@name, 'name')]", "doc_1"); selectById("//select[contains(@name, 'type')]", 1); insert("//input[contains(@name, 'start-date')]", "2015-10-15"); //Click button "Add" click("//button[contains(@value, 'Add')]"); //Check new document Thread.sleep(5000); shouldHaveText(labelFromProperties("document.properties", "document.message.successfully-add")); shouldHaveText("doc_1");
  • 11. xpath // Click button "Yes" click(".//body/table/dir/dir[6]/button[2]");
  • 14. Help me • Static analysis (Sonar) -> refactoring • sleep -> wait
  • 15. Help me vol2 • Project build structure • Page Object
  • 19. What is an API?
  • 21. @Test shouldRetrieveUserByLogin() { String userJson = "{"username": "vaidas"}"; HttpRequest post = new Post("https://localhost:8080/users", userJson); HttpResponse postResp = HttpClient().execute(post); assertThat(postResp.status, is(200)); HttpRequest get = new Get("https://localhost:8080/users/vaidas"); HttpResponse getResp = HttpClient().execute(get); User user = mapper.readValue(getResp, User.class); assertThat(username, is("vaidas")); }
  • 22. Few problems with such test ● Business requirements are mixed within implementation ● URLs are hardcoded ● Payload format is hardcoded ● Test exposes use of HTTP protocol
  • 23. Improved version @Test shouldRetrieveUserByUsername() { givenUserExists("vaidas"); GetUserResponse getResp = usersDriver.aGetUserRequest() .withUsername("vaidas").execute(); assertThat(getResp, allOf(hasStatus(OK), hasUsername("vaidas"))); }
  • 24. Driver pattern ● Abstracts implementation from business logic ● Removes duplication ● Test specification becomes reusable
  • 25. So, what if there’s a need to... ● Add another protocol (http + https) ● Another input format ● Test with different configuration ● Customize for different clients
  • 26. InternetBankApiTest extends BankApiTest with InternetBankDriver with InternetBankApiMatchers AtmApiTest extends BankApiTest with AtmDriver with AtmMatchers Depending on your programming language: ● Use inheritance or composition ● Java 8 has default method in interfaces ● Consider using another language - JavaScript, Groovy, Scala, etc
  • 27. What if there is difference between two implementations? ● Override tests by extending the contract class ● Use class hierarchy to group tests into reusable test suites
  • 28. Page Object pattern ● Is a variant of Driver pattern ● Selenium best practice ● encapsulates selector logic ● Solves the same problem as using drivers with API testing ● Does not have to be per page, but per component
  • 29. Test patterns summary ● Use Driver Pattern for Microservice/API ● Use Page Object for graphical interface
  • 31. Lessons learnt • Testers should not work separately from programmers • Quality matters • Allocate time to maintain tests • Or later it will cost €
  • 32. Summary ● Do more pairing ● Treat automation as a craft ● Regular feedback is a must