SlideShare a Scribd company logo
Trisha Gee (@trisha_gee)
Developer & Technical Advocate, JetBrains
Level Up Your
Automated Tests
Using <Technology X> Will Fix
Your Problems
•Write Tests?
•Write Readable Tests?
•Write Meaningful Tests?
How can we:
Why Don’t We Write Tests?
Level Up Your Automated Tests
What Are Tests For?
Level Up Your Automated Tests
What Are Tests Actually Good
For?
Level Up Your Automated Tests
How Can We Change Attitudes?
How Can We Change Behaviour?
Having a Champion
Quality becomes a habit
This can only get you so far
Remaining Problems
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
It needs to be easy
Possible Solutions
•EasyMock / Mockito / JMock
•Home-grown mocking / stubbing
•Hamcrest matchers
•DSL – Domain Specific Language
•Standards / Examples
Along came Spock
An Example Test
How it fixes our problems
Hard to read
Horrible Test Names
Level Up Your Automated Tests
Lots of setup
No Unit Tests
Level Up Your Automated Tests
Too many similar tests
Testing too many things
Testing too many things
Complicated Matrix
Proving itself
Level Up Your Automated Tests
Remaining Issues
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Level Up Your Automated Tests
Still more to be done
a) write tests?
How can we:
b) write readable tests?
How can we:
c) write meaningful tests?
How can we:
Conclusions
Make it easy
Automate everything
Zero tolerance for failures
Have a champion
Let it go
Pairing or code review
Focus on the purposes of testing
http://bit.ly/LevelUpTests
Questions?

More Related Content

PDF
Level Up Your Automated Tests
PDF
Code Review Matters and Manners
PPTX
Is Groovy better for testing than Java?
PPTX
2013 09-11 java zone - extreme programming live
PDF
How to get the most out of code reviews
PPT
TDD - Christchurch APN May 2012
PPTX
Intro to TDD
PPTX
Code Review
Level Up Your Automated Tests
Code Review Matters and Manners
Is Groovy better for testing than Java?
2013 09-11 java zone - extreme programming live
How to get the most out of code reviews
TDD - Christchurch APN May 2012
Intro to TDD
Code Review

What's hot (20)

PPTX
Code Review Best Practices
PPTX
Writing Better Tests - Applying Clean-Code TDD at 99designs
PDF
Test Driven Development
PPTX
Unit testing
PPTX
The problem with tdd
PPTX
Unit Test Lab - Why Write Unit Tests?
PPTX
Finding a good development partner
PPTX
Clean code - Getting your R&D on board
PPTX
Agile testingandautomation
PPTX
Roy Osherove TDD From Scratch
PPTX
Type mock isolator
PDF
PHP unit testing - good and bad practices
PPTX
Lập trình hướng kiểm thử - Test Driven development
PDF
Selenium Users Anonymous
PDF
TDD — Are you sure you properly test code?
PDF
Code Review for iOS
PPTX
Break to build - the mindset of the modern day tester
PPT
Reliable tests with selenium web driver
PDF
Pragmatic Architecture for Agile Teams - GeeCON 2014
PPTX
Hindsight lessons about API testing
Code Review Best Practices
Writing Better Tests - Applying Clean-Code TDD at 99designs
Test Driven Development
Unit testing
The problem with tdd
Unit Test Lab - Why Write Unit Tests?
Finding a good development partner
Clean code - Getting your R&D on board
Agile testingandautomation
Roy Osherove TDD From Scratch
Type mock isolator
PHP unit testing - good and bad practices
Lập trình hướng kiểm thử - Test Driven development
Selenium Users Anonymous
TDD — Are you sure you properly test code?
Code Review for iOS
Break to build - the mindset of the modern day tester
Reliable tests with selenium web driver
Pragmatic Architecture for Agile Teams - GeeCON 2014
Hindsight lessons about API testing
Ad

Similar to Level Up Your Automated Tests (20)

PDF
TDD and Simple Design Workshop - Session 1 - March 2019
PPTX
{10.0} Test Driven Development.pptx
PDF
A minimal Django testing styleguide
PDF
What would Jesus Developer do?
ODP
Mistakes I have made
PDF
[GAN by Hung-yi Lee]Part 3: The recent research of my group
PDF
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
PDF
TLC2018 Shyam Sunder: Legoizing Testing
PDF
TDD for Testers Workshop
PPT
Getting Unstuck: Working with Legacy Code and Data
PPSX
Modeling Requirements Narrated2
PPTX
Modeling Requirements with SysML
PDF
Continuous Deployment and Testing Workshop from Better Software West
PPTX
2014 toronto-torbug
PPTX
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
PPT
Unit Testing, TDD and the Walking Skeleton
PPT
Introduction to Test Driven Development
PPTX
Automated Testing with Logic Apps and Specflow
PDF
Kata Your Way to SW Craftsmanship
PDF
Can we induce change with what we measure?
TDD and Simple Design Workshop - Session 1 - March 2019
{10.0} Test Driven Development.pptx
A minimal Django testing styleguide
What would Jesus Developer do?
Mistakes I have made
[GAN by Hung-yi Lee]Part 3: The recent research of my group
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
TLC2018 Shyam Sunder: Legoizing Testing
TDD for Testers Workshop
Getting Unstuck: Working with Legacy Code and Data
Modeling Requirements Narrated2
Modeling Requirements with SysML
Continuous Deployment and Testing Workshop from Better Software West
2014 toronto-torbug
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
Unit Testing, TDD and the Walking Skeleton
Introduction to Test Driven Development
Automated Testing with Logic Apps and Specflow
Kata Your Way to SW Craftsmanship
Can we induce change with what we measure?
Ad

More from Trisha Gee (20)

PPTX
Career Advice for Architects
PPTX
Is boilerplate code really so bad?
PDF
Career Advice for Programmers - ProgNET London
PDF
Is Boilerplate Code Really So Bad?
PPTX
Real World Java 9 - JetBrains Webinar
PDF
Real World Java 9
PPTX
Real World Java 9
PPTX
Career Advice for Programmers
PPTX
Real World Java 9
PPTX
Becoming fully buzzword compliant
PDF
Real World Java 9 (QCon London)
PPTX
Java 9 Functionality and Tooling
PDF
Java 8 and 9 in Anger
PDF
Refactoring to Java 8 (Devoxx BE)
PDF
Refactoring to Java 8 (QCon New York)
PDF
Refactoring to Java 8 (Devoxx UK)
PDF
Staying Ahead of the Curve
PDF
Java 8 in Anger (JavaOne)
PPTX
Staying Ahead of the Curve
PDF
Java 8 in Anger, Devoxx France
Career Advice for Architects
Is boilerplate code really so bad?
Career Advice for Programmers - ProgNET London
Is Boilerplate Code Really So Bad?
Real World Java 9 - JetBrains Webinar
Real World Java 9
Real World Java 9
Career Advice for Programmers
Real World Java 9
Becoming fully buzzword compliant
Real World Java 9 (QCon London)
Java 9 Functionality and Tooling
Java 8 and 9 in Anger
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (QCon New York)
Refactoring to Java 8 (Devoxx UK)
Staying Ahead of the Curve
Java 8 in Anger (JavaOne)
Staying Ahead of the Curve
Java 8 in Anger, Devoxx France

Recently uploaded (20)

PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ai tools demonstartion for schools and inter college
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
top salesforce developer skills in 2025.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
Which alternative to Crystal Reports is best for small or large businesses.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ai tools demonstartion for schools and inter college
Online Work Permit System for Fast Permit Processing
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Navsoft: AI-Powered Business Solutions & Custom Software Development
Understanding Forklifts - TECH EHS Solution
CHAPTER 2 - PM Management and IT Context
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Odoo POS Development Services by CandidRoot Solutions
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Wondershare Filmora 15 Crack With Activation Key [2025
top salesforce developer skills in 2025.pdf
history of c programming in notes for students .pptx
ISO 45001 Occupational Health and Safety Management System
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Operating system designcfffgfgggggggvggggggggg
2025 Textile ERP Trends: SAP, Odoo & Oracle

Level Up Your Automated Tests

Editor's Notes

  • #2: This is a story of how to get more out of your automated tests This is my experiences at MongoDB, not JetBrains We had tests, we had coverage, but it felt more like a box-ticking exercise than a commitment to the value of tests or testing. And then we started using Spock, and magically everything got better
  • #3: This is NOT one of those talks Instead, I’m going to talk about the problems we were facing And some of the solutions that helped us, yes including some technology choices But we’ll see WHY they helped us
  • #5: We know testing is important, yet we still don’t do it when we should
  • #6: Common reasons why not 1 Too hard to setup 2 Single use code 3 The code is simple 4 Too hard to mock 5 UI code 6 Not enough time 7 Effort vs Value 8 I'm the only maintainer
  • #7: Let’s take a step back and look at a different question
  • #13: Me Asking why Jenkins was failing Fixing tests Adding checkstyle Fixing up checkstyle errors Dishing out remaining errors Pushing for tests in code reviews
  • #14: Get things green Require tests for code review Got use to making sure Jenkins and travis were green Got used to writing tests Reports are useful too
  • #15: There comes a point where it’s too hard to get the team to do everything you want You want it to be easy and logical for others to know what to do and how to do it The champion’s job is to put into place processes, practices, examples that become second nature to the team - checkstyle a success - unit testing not so much I kept wanting to re-write other’s tests, to add more tests. Good that our code review process didn’t allow that, or I would have become a tester
  • #16: Champion and good habits are a start Helped us address writing tests and writing readable tests to some extent We still had problems Some technical, some around improving quality (meaningfulness) of tests)
  • #17: Insert Jenkins matrix?
  • #26: MongoClientURITest
  • #27: Most of all It needs to be automatic for all the developers
  • #29: Found out about it at a conference like this one Was sceptical a library could solve what I thought were behavioural problems Addresses quite a lot of the issues we had Week of Spike
  • #30: // String method names // given/when/then // Map syntax // Type coercing // new BasicDBObject("$set", new BasicDBObject("x", 2) // equals
  • #31: Halfway
  • #34: Two things - @Subject - “when”
  • #35: Setup is explicit When the setup section gets big, sign that we should refactor (not just a Spock solution) Use “Fixture” for example – testDollarOutOnSecondary
  • #39: Same problem, different side of the coin
  • #42: - Catching server bugs - Catching regressions - Checking combinations of servers & drivers & java - How the team embraced it – using Spock for integration and API-level tests - Jenkins and Travis are now generally green, test coverage is up, tests written for new sections (async) Not driven by me: - Introduction of server specs - Then test specs to prove a driver meets the criteria - In future, would be great to have a TCK-like set of tests that can prove a driver meets MongoDB requirements (or some set of them)
  • #43: - Catching server bugs - Catching regressions - Checking combinations of servers & drivers & java - How the team embraced it – using Spock for integration and API-level tests - Jenkins and Travis are now generally green, test coverage is up, tests written for new sections (async) Not driven by me: - Introduction of server specs - Then test specs to prove a driver meets the criteria - In future, would be great to have a TCK-like set of tests that can prove a driver meets MongoDB requirements (or some set of them)
  • #44: Other problems - Performance - Dynamic lang has downsides - Now have even more inconsistency in our tests (but at least we know which are the new ones) - Refactoring – not so awesome with Spock - Still not clear to people what the different tests are for – unit, functional, integration, acceptance
  • #45: Perf is worse for running individual tests (Groovy has a startup cost) Perf is slower to run the overall build (Groovy, plus adding an extra gradle step) Perf is not RELIABLE – performance critical tests (i.e. with timeouts) needed to be Java
  • #46: - Masks errors - Finding problems at runtime instead of compile-time - (On the other hand, this is really useful when you don’t care about types or nulls or whatever) - Refactoring – not so awesome with Spock
  • #47: Now we have old tests, good junit, spock (unit), spock (functional)
  • #48: Expected spock to be used for unit only Then we could be clear about spock – single class or a couple of classes Now we’re not really sure about the difference between unit, functional, acceptance.
  • #49: What I’d like it to do - I still want tests that document the system - I’d like automated perf tests, but production-like data is too hard - I’d like soak tests - I’d like much more complicated tests, which do more than one thing (is it not enough to test each piece individually?) - I’d like more unit tests - Basically want more types of tests, with better clarity on the purpose of each test type. Originally hoped Spock would be for unit, and all integration tests would be truly end-to-end and Java
  • #50: - Pairing - Code Reviews - Make it simple - Make it fun - Understand WHY we test - *Could* use coverage
  • #51: Groovy helped us - DSLs - Gwen - even (shock) comments - good test names - test one thing (have single reason for failure?) - make it clear what’s under test, what’s expectations - extract common functions (connect to DB, get server, etc) - Have good example tests for people to follow (guidelines) - Make tests a first class citizen (code review for example) - This is all just common code practices, it’s the same for tests as it is for production code. Somehow, we fail to do this in tests
  • #52: - This might actually be the hardest thing to do. Define meaning - Code review - Understand the purpose of the test – end-to-end? Unit? Checking the server? Checking your assumptions? Documentation? Requirements? - Tester mindset – What if? What does this mean? What are the implications? - |Good idea to get someone who isn’t close to the code or the system to check out the tes
  • #53: Suspect coverage is the wrong metric to drive things A new language might be a fun way to get developers to pay attention to tests (or it might be a hindrance)
  • #55: Jenkins Static analysis Coverage
  • #56: Either fix it Or delete it
  • #57: Have a champion – someone needs to give a shit And they need to not get annoyed at pushing this all the time
  • #58: Don’t be religious Don’t hold tight to ideals, go with what works (Spock not just for unit; having to let go of acceptance tests)
  • #59: Or code showcase