SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Downloaden Sie, um offline zu lesen
End-End tests as
first class citizens
Abhijeet Vaikar
Abhijeet Vaikar
Senior Software Engineer Co-organizer
Testing software and writing test code since 8 years
Maintainer
abhijeetvaikar @AbhijeetVaikar
Poll Time!
Are you involved with developing, maintaining
and enhancing an in-house Selenium/Appium
based test framework and test code at your
work?
Value from e2e automated tests
Detect bugs Frequent feedback Faster delivery cycles Flexibility
Reliable testing Reduced costs
“My tests were working until yesterday. Today they are not”
“Today’s regression run for Android didn’t execute at all”
“Tests are failing locally, did we change something in the framework?”
“Slack notifications are not being sent for test runs. What happened?”
“Someone accidentally checked-in sensitive values in test code”
Test Engineering team
“The branch name in the regression jenkins job has been changed.”
“Sign up tests are failing due to NullPointerException”
“What does this new method in the framework do?”
Ensure quality of your e2e test
framework and test code
Reliable Ease of use
Stable
What “Quality” means for test framework and scripts?
What “Quality” means for test framework and scripts?
**Preventing issues/bugs in your test framework / test code earlier to avoid surprises in your actual runs
Production Code
Test Code
1st
2nd
How do we ensure quality of test framework and test
code?
Production
Code
How do we ensure quality of test framework and test
code?
Test
Code
1st
2nd
E2E test automation @ Carousell - Overview
Development
environment
Version Control Continuous
Integration
Dependency
Management
Automation libs
Test-case
Management
CarouFarm
Devices Execution Env Test Notifications App/Log/video/
test account storage
E2E test automation @ Carousell - Overview
● FFT (Fast Feedback Tests)
● Daily regression
● Sanity runs
Principles and practices we adopted
Code Process & People
All changes on dedicated branch
Automated checks on PR
● Is code formatted?
● Does code compile?
● Do unit/integration tests pass?
● Does code pass SonarCloud quality
gate?
● Have reviewers approved your PR?
❌ ✅
Block PR until checks fixed
Good to merge
in master
Jenkinsfile
Automated checks on PR - Code formatting
Is code formatted?
Automating code format checks using Google Java Style Guide
Automated checks on PR - Static Code Analysis
Does code pass SonarCloud quality gate?
Using static code analysis tool SonarCloud to analyse code against industry standard quality gates
SonarCloud quality gates:
● Reliability
● Security
● Maintainability
● Coverage
● Duplications
Automated checks on PR - Static Code Analysis
Automated checks on PR - Unit/Integration tests
https://twitter.com/maaretp/status/1166705548450062336
Automated checks on PR - Unit/Integration tests
Driver management Test Data handlers
Cloud service
handlers
Testcase
management
system handlers
Configuration
handlers
All classes that
support correct
functioning of the
test framework
Page Objects
Test classes /
Feature files / Test
specs
Reporting handlers
Write unit/integration
tests
Don’t write
unit/integration tests
A test framework is also a software
product used by engineers.
Automated checks on PR - Unit/Integration tests
@RunWith(MockitoJUnitRunner. class)
public class LoginServiceTest {
@Mock private Dependency dependency;
private LoginService loginService;
@Before
public void setUp() {
System.setProperty("env", "prod");
}
@Test
public void testLoginGetNewTokenSuccess() {
}
@Test
public void testLoginGetExistingTokenSuccess() {
}
Automated checks on PR - Unit/Integration tests
Automated checks on PR - Unit/Integration tests
/** Unit Test for Class TM4J Service */
@RunWith(MockitoJUnitRunner. class)
public class Tm4jServiceTest {
private TM4JService tm4jService;
@Before
public void init() {
System.setProperty(PropertyConstants. TM4J_URL, "http://tm4j-url" );
System.setProperty(PropertyConstants. TM4J_TEST_CYCLE_ID , "TEST-AAA");
System.setProperty(PropertyConstants. TM4J_PROJECT_ID , "TEST");
}
@Test
public void testUpdateSuccessful() {
}
@Test
public void testUpdateFailed() {
}
Automated checks on PR - Unit/Integration tests
Selenium has
unit tests too!
https://twitter.com/BugHunterSam/status/1184317541239283712
Code Reviews
Code Reviews
Code Reviews
Helps a contributor ensure
that they have done all the
due diligence before trying
to create the PR or merge
the PR in the master branch
Pull Request checklist
Splitting framework code and test code into 2 separate
projects
Before After
Test Framework
&
Test Code
Test
Framework
Test Code
Splitting framework code and test code into 2 separate
projects
Test Code
Test
Framework
<parent>
<groupId>group-name</groupId>
<artifactId>framework</artifactId>
<version>20.08.20.170019</version>
</parent>
Adopting Jenkins pipeline instead of conventional job
configuration (pipeline as code)
Before After
● All configuration on Jenkins
● Difficult to track changes done
in jobs
● All configuration in a Jenkinsfile
● Jenkinsfile is version controlled in the project so
it goes through review before being used.
Test environment for test runs
Isolating real test runs from “debug” test runs
● Separate CI jobs for testing out changes to framework or test suite code.
● Separate TM4J test cycle for testing integrations
● Separate DB instance to test database integrations
Intent: Do not disturb the production tests no matter what.
Faster analysis of issues when things break
Faster analysis of issues when things break
Good coding principles
● Keeping tests short and atomic.
● Separation of concerns/responsibilities using:
○ Feature files (Describing user acceptance)
○ Step classes calling pageobjects & performing assertions.
○ Page Objects (only layer which deals with driver)
● Avoiding repetition (DRY) using abstraction wherever necessary.
● Javadocs for public methods in framework code.
● Efficient locators.
● Avoiding shared state between tests (for eg. use of static methods)
Good coding principles
● Knowing when to catch exceptions and when to let them fail tests.
● Being smart about waiting mechanisms.
● Using a logging framework instead of System.out.println().
● Not checking in sensitive data in the code repository. Using git-secrets.
● Removing dead code
● Using boy scout rule - Leave your code better than you found it.
Team collaboration, communication & planning
● Planning strategic changes to framework well. RFCs are a good way to do it.
● Thinking about possible failures when designing solutions for test framework and integrations.
● Prioritising high impact tests for end-end UI coverage and not automating all your tests on the UI.
Distribute tests across all the layers consciously.
● Conducting sprint review sessions where any significant work done is demonstrated and made
open to questions and discussions.
● Pair programming & pair brainstorming sessions.
● Encouraging an open mindset when it comes to asking questions & giving feedback on code.
● Creating JIRA tickets any time we come across tech debt.
● Proactively planning to fix tech debt regularly.
Key takeaways & learnings
Write unit/integration tests
for core components and
integrations that make (and
break) your framework &
test code
Key takeaways & learnings
Create build pipeline for
your test framework and
test code using CI
Key takeaways & learnings
Automate checks at PR level
to avoid issues creeping into
your daily test runs that
matter
❌ ✅
Key takeaways & learnings
Conduct code reviews
religiously
Key takeaways & learnings
Adopt good coding principles and design patterns
to ensure making changes in code is easy
DRY
Images: https://team-coder.com/solid-principles/, https://thevaluable.dev/dry-principle-cost-benefit-example/
Key takeaways & learnings
Establish a practice of open
& frequent communication in
the team driven by
retrospection and
continuous improvement.
Thank you!

Weitere ähnliche Inhalte

Ähnlich wie End-end tests as first class citizens - SeleniumConf 2020

Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
Curiosity Software Ireland
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
gaoliang641
 

Ähnlich wie End-end tests as first class citizens - SeleniumConf 2020 (20)

How to Avoid Continuously Delivering Faulty Software
How to Avoid Continuously Delivering Faulty SoftwareHow to Avoid Continuously Delivering Faulty Software
How to Avoid Continuously Delivering Faulty Software
 
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App TestingSencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
Sencha Roadshow 2017: Best Practices for Implementing Continuous Web App Testing
 
Prakasha_Resume
Prakasha_ResumePrakasha_Resume
Prakasha_Resume
 
How To Avoid Continuously Delivering Faulty Software
How To Avoid Continuously Delivering Faulty SoftwareHow To Avoid Continuously Delivering Faulty Software
How To Avoid Continuously Delivering Faulty Software
 
Technical Practices for Agile Engineering - PNSQC 2019
Technical Practices for Agile Engineering - PNSQC 2019Technical Practices for Agile Engineering - PNSQC 2019
Technical Practices for Agile Engineering - PNSQC 2019
 
Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015Code in the Cloud - Ghent - 20 February 2015
Code in the Cloud - Ghent - 20 February 2015
 
Resume_Trupti
Resume_TruptiResume_Trupti
Resume_Trupti
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Agile testing
Agile testingAgile testing
Agile testing
 
Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015
 
Agile Testing 2020
Agile Testing 2020Agile Testing 2020
Agile Testing 2020
 
Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
Curiosity and Xray present - In sprint testing: Aligning tests and teams to r...
 
(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know(Agile) engineering best practices - What every project manager should know
(Agile) engineering best practices - What every project manager should know
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
 
Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)Unit testing (Exploring the other side as a tester)
Unit testing (Exploring the other side as a tester)
 
Presentation Verification & Validation
Presentation Verification & ValidationPresentation Verification & Validation
Presentation Verification & Validation
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...
 
Continuous Integration for z using Test Data Management and Application D...
Continuous  Integration for z  using  Test Data Management  and Application D...Continuous  Integration for z  using  Test Data Management  and Application D...
Continuous Integration for z using Test Data Management and Application D...
 
SivaRamaKrishna_CV_9.6 yrs Testing
SivaRamaKrishna_CV_9.6 yrs TestingSivaRamaKrishna_CV_9.6 yrs Testing
SivaRamaKrishna_CV_9.6 yrs Testing
 

Mehr von Abhijeet Vaikar

Mehr von Abhijeet Vaikar (6)

Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
 
Upgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced DebuggingUpgrading Mobile Tester's Weapons with Advanced Debugging
Upgrading Mobile Tester's Weapons with Advanced Debugging
 
Mongo DB 102
Mongo DB 102Mongo DB 102
Mongo DB 102
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 

Kürzlich hochgeladen

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Kürzlich hochgeladen (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

End-end tests as first class citizens - SeleniumConf 2020

  • 1. End-End tests as first class citizens Abhijeet Vaikar
  • 2. Abhijeet Vaikar Senior Software Engineer Co-organizer Testing software and writing test code since 8 years Maintainer abhijeetvaikar @AbhijeetVaikar
  • 3. Poll Time! Are you involved with developing, maintaining and enhancing an in-house Selenium/Appium based test framework and test code at your work?
  • 4. Value from e2e automated tests Detect bugs Frequent feedback Faster delivery cycles Flexibility Reliable testing Reduced costs
  • 5. “My tests were working until yesterday. Today they are not” “Today’s regression run for Android didn’t execute at all” “Tests are failing locally, did we change something in the framework?” “Slack notifications are not being sent for test runs. What happened?” “Someone accidentally checked-in sensitive values in test code” Test Engineering team “The branch name in the regression jenkins job has been changed.” “Sign up tests are failing due to NullPointerException” “What does this new method in the framework do?”
  • 6. Ensure quality of your e2e test framework and test code
  • 7. Reliable Ease of use Stable What “Quality” means for test framework and scripts?
  • 8. What “Quality” means for test framework and scripts? **Preventing issues/bugs in your test framework / test code earlier to avoid surprises in your actual runs
  • 9. Production Code Test Code 1st 2nd How do we ensure quality of test framework and test code?
  • 10. Production Code How do we ensure quality of test framework and test code? Test Code 1st 2nd
  • 11. E2E test automation @ Carousell - Overview Development environment Version Control Continuous Integration Dependency Management Automation libs Test-case Management CarouFarm Devices Execution Env Test Notifications App/Log/video/ test account storage
  • 12. E2E test automation @ Carousell - Overview ● FFT (Fast Feedback Tests) ● Daily regression ● Sanity runs
  • 13. Principles and practices we adopted Code Process & People
  • 14. All changes on dedicated branch
  • 15. Automated checks on PR ● Is code formatted? ● Does code compile? ● Do unit/integration tests pass? ● Does code pass SonarCloud quality gate? ● Have reviewers approved your PR? ❌ ✅ Block PR until checks fixed Good to merge in master Jenkinsfile
  • 16. Automated checks on PR - Code formatting Is code formatted? Automating code format checks using Google Java Style Guide
  • 17. Automated checks on PR - Static Code Analysis Does code pass SonarCloud quality gate? Using static code analysis tool SonarCloud to analyse code against industry standard quality gates
  • 18. SonarCloud quality gates: ● Reliability ● Security ● Maintainability ● Coverage ● Duplications Automated checks on PR - Static Code Analysis
  • 19. Automated checks on PR - Unit/Integration tests https://twitter.com/maaretp/status/1166705548450062336
  • 20. Automated checks on PR - Unit/Integration tests Driver management Test Data handlers Cloud service handlers Testcase management system handlers Configuration handlers All classes that support correct functioning of the test framework Page Objects Test classes / Feature files / Test specs Reporting handlers Write unit/integration tests Don’t write unit/integration tests A test framework is also a software product used by engineers.
  • 21. Automated checks on PR - Unit/Integration tests
  • 22. @RunWith(MockitoJUnitRunner. class) public class LoginServiceTest { @Mock private Dependency dependency; private LoginService loginService; @Before public void setUp() { System.setProperty("env", "prod"); } @Test public void testLoginGetNewTokenSuccess() { } @Test public void testLoginGetExistingTokenSuccess() { } Automated checks on PR - Unit/Integration tests
  • 23. Automated checks on PR - Unit/Integration tests /** Unit Test for Class TM4J Service */ @RunWith(MockitoJUnitRunner. class) public class Tm4jServiceTest { private TM4JService tm4jService; @Before public void init() { System.setProperty(PropertyConstants. TM4J_URL, "http://tm4j-url" ); System.setProperty(PropertyConstants. TM4J_TEST_CYCLE_ID , "TEST-AAA"); System.setProperty(PropertyConstants. TM4J_PROJECT_ID , "TEST"); } @Test public void testUpdateSuccessful() { } @Test public void testUpdateFailed() { }
  • 24. Automated checks on PR - Unit/Integration tests Selenium has unit tests too!
  • 28. Helps a contributor ensure that they have done all the due diligence before trying to create the PR or merge the PR in the master branch Pull Request checklist
  • 29. Splitting framework code and test code into 2 separate projects Before After Test Framework & Test Code Test Framework Test Code
  • 30. Splitting framework code and test code into 2 separate projects Test Code Test Framework <parent> <groupId>group-name</groupId> <artifactId>framework</artifactId> <version>20.08.20.170019</version> </parent>
  • 31. Adopting Jenkins pipeline instead of conventional job configuration (pipeline as code) Before After ● All configuration on Jenkins ● Difficult to track changes done in jobs ● All configuration in a Jenkinsfile ● Jenkinsfile is version controlled in the project so it goes through review before being used.
  • 32. Test environment for test runs Isolating real test runs from “debug” test runs ● Separate CI jobs for testing out changes to framework or test suite code. ● Separate TM4J test cycle for testing integrations ● Separate DB instance to test database integrations Intent: Do not disturb the production tests no matter what.
  • 33. Faster analysis of issues when things break
  • 34. Faster analysis of issues when things break
  • 35. Good coding principles ● Keeping tests short and atomic. ● Separation of concerns/responsibilities using: ○ Feature files (Describing user acceptance) ○ Step classes calling pageobjects & performing assertions. ○ Page Objects (only layer which deals with driver) ● Avoiding repetition (DRY) using abstraction wherever necessary. ● Javadocs for public methods in framework code. ● Efficient locators. ● Avoiding shared state between tests (for eg. use of static methods)
  • 36. Good coding principles ● Knowing when to catch exceptions and when to let them fail tests. ● Being smart about waiting mechanisms. ● Using a logging framework instead of System.out.println(). ● Not checking in sensitive data in the code repository. Using git-secrets. ● Removing dead code ● Using boy scout rule - Leave your code better than you found it.
  • 37. Team collaboration, communication & planning ● Planning strategic changes to framework well. RFCs are a good way to do it. ● Thinking about possible failures when designing solutions for test framework and integrations. ● Prioritising high impact tests for end-end UI coverage and not automating all your tests on the UI. Distribute tests across all the layers consciously. ● Conducting sprint review sessions where any significant work done is demonstrated and made open to questions and discussions. ● Pair programming & pair brainstorming sessions. ● Encouraging an open mindset when it comes to asking questions & giving feedback on code. ● Creating JIRA tickets any time we come across tech debt. ● Proactively planning to fix tech debt regularly.
  • 38. Key takeaways & learnings Write unit/integration tests for core components and integrations that make (and break) your framework & test code
  • 39. Key takeaways & learnings Create build pipeline for your test framework and test code using CI
  • 40. Key takeaways & learnings Automate checks at PR level to avoid issues creeping into your daily test runs that matter ❌ ✅
  • 41. Key takeaways & learnings Conduct code reviews religiously
  • 42. Key takeaways & learnings Adopt good coding principles and design patterns to ensure making changes in code is easy DRY Images: https://team-coder.com/solid-principles/, https://thevaluable.dev/dry-principle-cost-benefit-example/
  • 43. Key takeaways & learnings Establish a practice of open & frequent communication in the team driven by retrospection and continuous improvement.