SlideShare a Scribd company logo
AvoidingTest Hell
Yun Ki Lee
yunki.lee@gmail.com
1
Overview
• WhyTest?
• Sample Application
• BDD and FitNesse
• What would you consider hell to be like?
• How to get into hell
• And how to make it less painful
2
Sample Price Reporting App
• We are a financial service provider
• Loads security prices from a client
• Produces internally calculated security
prices
• Compares the two prices and selects a
price based on a rule
• Produces a valuation report
Client Reporting Module
Client Prices
Price
Comparator Valuations
File
Valuation
Generator
Internal
Price
Calculator
Client Price
Loader
3
Testing Basics
• Why
• To prove what you’ve done works and is what they asked for
• Reduce risk when doing deployment to production
• How
• Manual vs Automated
• Different types of tests, unit tests, component tests, integration tests and so on
• When
• After development is complete? (Waterfall)
• Before you do any development? (TDD)
• Who
• Dedicated team of testers?
• Developers, BAs, users?
4
BDD: Behaviour Driven Development
• Focus on the behaviour
• As a … I want … so that
• Given … when … then …
5
FitNesse
Wiki Fixtures
System
Under
Test
6
Tables
Java Code (System
UnderTest)
How to know whether you’re inTest Hell
• Your tests costs you more than they save you
• How long until you can release the next release into production?
• If you don’t do any manual testing, are you good to go?
• If a test fails, do you believe that it has failed?
• If a test passes, do you trust it?
• How long until a new joiner can get up and running writing tests?
• A function needs to be changed, how long until the tests can be updated?
7
Holding up Releases due toTesting
• How long does it take to arrive at a go / no go decision?
• Manual testing
• Release process not tested and automated
• Solution: automate environment deployments
• Reduce manual steps
• Co-locate services for faster deployments
8
When a test fails
• Did it really fail?
• How long does it take to verify it’s a genuine break?
• Was the failure due to system state?
• Have you got some wait condition so that an action can complete?
• Are you running tests in parallel but have some shared data?
• Solutions:
• Do not hide testing data (next slide)
• Isolate tests that exhibit random behavior (next slide)
• Retry?
9
10
11
Testing Boundaries
PriceComparisonEngine
Thread
Price Loader
extractPrices(source)
Price Rules Persister
loadRules(rule)
comparePrices()
persistPrices()
• Do you want to test the whole engine?
• Or just a couple of features?
12
When a test passes
• Have you got enough coverage to be confident enough to say the
functionality works
• Vertical vs horizontal coverage
• Coverage tools
13
How easy is it to maintain tests?
• Adding new tests
• How easy is it for these people?
• Experienced? New? Haven’t touched the system in a while?
• Modifying tests for new functionality?
• How many tests do they have to update?
• Solution
• Documentation and libraries
• DRY principle
14
Technical Debt inTests
• Packaging of test code isn’t maintained as well
as code
• Less time spent refactoring and reducing
duplication
• Often you will find similar methods that differ
by one or two parameters
• Solution
• Refactor and remove duplicate methods
• Create libraries or APIs that create test objects
15
Mocking
• Simulate behavior of components and
interfaces so that we can isolate that one
component we want to test
• Faster than connecting to a file system or a
database
• Can be brittle and a nightmare to maintain
• Can alleviate some issues if you create a test
library that hides some of the unnecessary
details
PriceComparisonEngine
Thread
Price Loader
extractPrices(source)
Price Rules Persister
loadRules(rule)
comparePrices()
persistPrices()
16
Test Objects
17
Vendor Software and External Data Providers
• Can not control when API and interface
changes
• Complex data sets
• Potentially quite difficult to mock out their
interfaces
• Pitfalls of the following approaches
• Capture and Replay: changes in message
format
• Table dumps: what if table structure changes
due to version upgrade?
• Solution
• Use theVendor API where possible
18
People Issues
• The largest contributor toTest Hell: the people in your team
• What are their motivations?What do they get from doing more frequent releases?
• Why do they want to do anything different?Why replace their manual tasks with automation?
• Structure of your team
• Who is good at what role? Not everyone is the same
• Personality types such as: MBTI
• What if they don’t believe in testing?
• Gamification?
• Who are management focusing their attention on?The poor performers at the cost of good
performers? 19
Things to Google …
• UnitTesting
• BDD
• TDD
• Jmock
• EasyMock
• PowerMock
• Junit
• Continuous Integration
• Object Mothers vsTest Builders
• Test Coverage
• DevOps
• FitNesse
• Concordion
• Cucumber
• JBehave
20

More Related Content

What's hot (20)

POTX
Functional Tests. PHP Unconf 2016
Vladislav Fedorischev
 
PDF
CNUG TDD June 2014
Mayank Srivastava
 
PPTX
TDD Basics with Angular.js and Jasmine
Luis Sánchez Castellanos
 
PPTX
Test Driven Development - a Practitioner’s Perspective
Malinda Kapuruge
 
PPTX
Approval Tests in Action: A LEGO Exercise and an Experience Report
houseofyin
 
PDF
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
.NET Conf UY
 
PPTX
Benefits from AATs
Wyn B. Van Devanter
 
PPT
Practical TDD Demonstrated
Alan Christensen
 
PPTX
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Codecamp Romania
 
PDF
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
AgileNetwork
 
PPTX
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Neotys_Partner
 
PPTX
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
Vincent Biret
 
PPTX
Unit tests benefits
Kate Semizhon
 
PPTX
#1 unit testing
eleksdev
 
PPTX
Addressing Security Regression Through Unit Testing
Christopher Grayson
 
PPTX
An Introduction to Unit Testing
Sahar Nofal
 
PPTX
Testing regression
Richie Lee
 
PDF
2020-Feb: Testing: Cables and Chains
Mark Windholtz
 
PPTX
Grant Fritchey Justin Caldicott - Best practices for database deployments
Red Gate Software
 
PPTX
Performance Tuning in the Trenches
Donald Belcham
 
Functional Tests. PHP Unconf 2016
Vladislav Fedorischev
 
CNUG TDD June 2014
Mayank Srivastava
 
TDD Basics with Angular.js and Jasmine
Luis Sánchez Castellanos
 
Test Driven Development - a Practitioner’s Perspective
Malinda Kapuruge
 
Approval Tests in Action: A LEGO Exercise and an Experience Report
houseofyin
 
Getting Ahead of Delivery Issues with Deep SDLC Analysis by Donald Belcham
.NET Conf UY
 
Benefits from AATs
Wyn B. Van Devanter
 
Practical TDD Demonstrated
Alan Christensen
 
Iasi code camp 20 april 2013 marian chicu - database unit tests in the sql se...
Codecamp Romania
 
Agile Mumbai 2020 Conference | How to get the best ROI on Your Test Automati...
AgileNetwork
 
Jonathon Wright - Intelligent Performance Cognitive Learning (AIOps)
Neotys_Partner
 
#ESPC18 How to do #devops with the #SharePoint Framework and why it matters?
Vincent Biret
 
Unit tests benefits
Kate Semizhon
 
#1 unit testing
eleksdev
 
Addressing Security Regression Through Unit Testing
Christopher Grayson
 
An Introduction to Unit Testing
Sahar Nofal
 
Testing regression
Richie Lee
 
2020-Feb: Testing: Cables and Chains
Mark Windholtz
 
Grant Fritchey Justin Caldicott - Best practices for database deployments
Red Gate Software
 
Performance Tuning in the Trenches
Donald Belcham
 

Viewers also liked (15)

PPTX
Análisis DAFO de una experiencia de fomento de competencias STEM
Aitor Lizarazu
 
PDF
Drug dispensing contact lenses a reality
Dominick Maino
 
PDF
Uso educativo del twitter
Miren Iriarte Arteaga
 
DOC
CV TemplateREV [1]
Brian Roberts
 
PDF
Mitarbeit an Relaunches
Thomas Matterne
 
PPTX
Hydrogels and silicone hydrogels
CHURAWAN LAL SAHU
 
PPTX
Scientific measurement protocols 1
CHURAWAN LAL SAHU
 
PPTX
Sports injuries & its prevention
akash mitra
 
PPTX
REYLEIGH’S METHOD,BUCKINGHAM π-THEOREM
Amiraj College Of Engineering And Technology
 
PPTX
Factors behind emergence of resistance
katefranklyn
 
PPTX
Why it is important
MikylaJRata
 
PDF
printing press startup
manimp manimp
 
PPTX
0 th review
Naga Pradeep Deepu
 
PPTX
Orlando Agrippa, Draper & Dash at "Journeys of Health-Tech Innovation" Nov 3...
Health-Tech Innovation LABS
 
PDF
Cambios de escenarios, nuevos repartos y guiones
Centro Internacional de Tecnologías Avanzadas. FGSR
 
Análisis DAFO de una experiencia de fomento de competencias STEM
Aitor Lizarazu
 
Drug dispensing contact lenses a reality
Dominick Maino
 
Uso educativo del twitter
Miren Iriarte Arteaga
 
CV TemplateREV [1]
Brian Roberts
 
Mitarbeit an Relaunches
Thomas Matterne
 
Hydrogels and silicone hydrogels
CHURAWAN LAL SAHU
 
Scientific measurement protocols 1
CHURAWAN LAL SAHU
 
Sports injuries & its prevention
akash mitra
 
REYLEIGH’S METHOD,BUCKINGHAM π-THEOREM
Amiraj College Of Engineering And Technology
 
Factors behind emergence of resistance
katefranklyn
 
Why it is important
MikylaJRata
 
printing press startup
manimp manimp
 
0 th review
Naga Pradeep Deepu
 
Orlando Agrippa, Draper & Dash at "Journeys of Health-Tech Innovation" Nov 3...
Health-Tech Innovation LABS
 
Cambios de escenarios, nuevos repartos y guiones
Centro Internacional de Tecnologías Avanzadas. FGSR
 
Ad

Similar to Avoiding test hell (20)

PDF
What CS Class Didn't Teach About Testing
Camille Bell
 
PDF
Build the Right Regression Suite with Behavior-Driven Testing
TechWell
 
PDF
Moving to Continuous Delivery Without Breaking Your Code
XebiaLabs
 
PPTX
Real Testing Scenario Strategy - Bringing It All Together For Success
Adam Sandman
 
PPTX
Automated tests
Damian Sromek
 
PDF
[Paul Holland] Trends in Software Testing
Ho Chi Minh City Software Testing Club
 
PPT
Automated Testing vs Manual Testing.ppt
ZakriyaMalik2
 
PPT
Automated Testing v s Manual Testing.ppt
ZakriyaMalik2
 
PPTX
Agile Testing Agile Ottawa April 2015
Dag Rowe
 
PPTX
Leandro Melendez - Switching Performance Left & Right
Neotys_Partner
 
PPTX
Software testing
Nico Heidtke
 
PPT
UNIT IV.ppt
Varshini62
 
PDF
Dragonfly Software Testing
dragonflytestoffpage
 
PPTX
Test Strategy-The real silver bullet in testing by Matthew Eakin
QA or the Highway
 
PPT
Application Testing
Reggie Niccolo Santos
 
PPTX
Testing
Christian Rubiales
 
PDF
Test Automation: Investment Today Pays Back Tomorrow
TechWell
 
PDF
Anand Bagmar - Behavior Driven Testing (BDT) in Agile
Anand Bagmar
 
PDF
Building the "right" regression suite using Behavior Driven Testing (BDT)
Anand Bagmar
 
PDF
We are sinking: Hitting the testing iceberg (CukenFest London, 2018)
Gáspár Nagy
 
What CS Class Didn't Teach About Testing
Camille Bell
 
Build the Right Regression Suite with Behavior-Driven Testing
TechWell
 
Moving to Continuous Delivery Without Breaking Your Code
XebiaLabs
 
Real Testing Scenario Strategy - Bringing It All Together For Success
Adam Sandman
 
Automated tests
Damian Sromek
 
[Paul Holland] Trends in Software Testing
Ho Chi Minh City Software Testing Club
 
Automated Testing vs Manual Testing.ppt
ZakriyaMalik2
 
Automated Testing v s Manual Testing.ppt
ZakriyaMalik2
 
Agile Testing Agile Ottawa April 2015
Dag Rowe
 
Leandro Melendez - Switching Performance Left & Right
Neotys_Partner
 
Software testing
Nico Heidtke
 
UNIT IV.ppt
Varshini62
 
Dragonfly Software Testing
dragonflytestoffpage
 
Test Strategy-The real silver bullet in testing by Matthew Eakin
QA or the Highway
 
Application Testing
Reggie Niccolo Santos
 
Test Automation: Investment Today Pays Back Tomorrow
TechWell
 
Anand Bagmar - Behavior Driven Testing (BDT) in Agile
Anand Bagmar
 
Building the "right" regression suite using Behavior Driven Testing (BDT)
Anand Bagmar
 
We are sinking: Hitting the testing iceberg (CukenFest London, 2018)
Gáspár Nagy
 
Ad

Recently uploaded (20)

PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 

Avoiding test hell

  • 2. Overview • WhyTest? • Sample Application • BDD and FitNesse • What would you consider hell to be like? • How to get into hell • And how to make it less painful 2
  • 3. Sample Price Reporting App • We are a financial service provider • Loads security prices from a client • Produces internally calculated security prices • Compares the two prices and selects a price based on a rule • Produces a valuation report Client Reporting Module Client Prices Price Comparator Valuations File Valuation Generator Internal Price Calculator Client Price Loader 3
  • 4. Testing Basics • Why • To prove what you’ve done works and is what they asked for • Reduce risk when doing deployment to production • How • Manual vs Automated • Different types of tests, unit tests, component tests, integration tests and so on • When • After development is complete? (Waterfall) • Before you do any development? (TDD) • Who • Dedicated team of testers? • Developers, BAs, users? 4
  • 5. BDD: Behaviour Driven Development • Focus on the behaviour • As a … I want … so that • Given … when … then … 5
  • 7. How to know whether you’re inTest Hell • Your tests costs you more than they save you • How long until you can release the next release into production? • If you don’t do any manual testing, are you good to go? • If a test fails, do you believe that it has failed? • If a test passes, do you trust it? • How long until a new joiner can get up and running writing tests? • A function needs to be changed, how long until the tests can be updated? 7
  • 8. Holding up Releases due toTesting • How long does it take to arrive at a go / no go decision? • Manual testing • Release process not tested and automated • Solution: automate environment deployments • Reduce manual steps • Co-locate services for faster deployments 8
  • 9. When a test fails • Did it really fail? • How long does it take to verify it’s a genuine break? • Was the failure due to system state? • Have you got some wait condition so that an action can complete? • Are you running tests in parallel but have some shared data? • Solutions: • Do not hide testing data (next slide) • Isolate tests that exhibit random behavior (next slide) • Retry? 9
  • 10. 10
  • 11. 11
  • 12. Testing Boundaries PriceComparisonEngine Thread Price Loader extractPrices(source) Price Rules Persister loadRules(rule) comparePrices() persistPrices() • Do you want to test the whole engine? • Or just a couple of features? 12
  • 13. When a test passes • Have you got enough coverage to be confident enough to say the functionality works • Vertical vs horizontal coverage • Coverage tools 13
  • 14. How easy is it to maintain tests? • Adding new tests • How easy is it for these people? • Experienced? New? Haven’t touched the system in a while? • Modifying tests for new functionality? • How many tests do they have to update? • Solution • Documentation and libraries • DRY principle 14
  • 15. Technical Debt inTests • Packaging of test code isn’t maintained as well as code • Less time spent refactoring and reducing duplication • Often you will find similar methods that differ by one or two parameters • Solution • Refactor and remove duplicate methods • Create libraries or APIs that create test objects 15
  • 16. Mocking • Simulate behavior of components and interfaces so that we can isolate that one component we want to test • Faster than connecting to a file system or a database • Can be brittle and a nightmare to maintain • Can alleviate some issues if you create a test library that hides some of the unnecessary details PriceComparisonEngine Thread Price Loader extractPrices(source) Price Rules Persister loadRules(rule) comparePrices() persistPrices() 16
  • 18. Vendor Software and External Data Providers • Can not control when API and interface changes • Complex data sets • Potentially quite difficult to mock out their interfaces • Pitfalls of the following approaches • Capture and Replay: changes in message format • Table dumps: what if table structure changes due to version upgrade? • Solution • Use theVendor API where possible 18
  • 19. People Issues • The largest contributor toTest Hell: the people in your team • What are their motivations?What do they get from doing more frequent releases? • Why do they want to do anything different?Why replace their manual tasks with automation? • Structure of your team • Who is good at what role? Not everyone is the same • Personality types such as: MBTI • What if they don’t believe in testing? • Gamification? • Who are management focusing their attention on?The poor performers at the cost of good performers? 19
  • 20. Things to Google … • UnitTesting • BDD • TDD • Jmock • EasyMock • PowerMock • Junit • Continuous Integration • Object Mothers vsTest Builders • Test Coverage • DevOps • FitNesse • Concordion • Cucumber • JBehave 20

Editor's Notes

  • #3: I don’t have a silver bullet for everything The advice I am to give is more practical rather than theoretical. Its easy to talk about ideal world solutions but unfortunately, the projects I worked on weren’t perfect. We had things called deadlines and constraints on budgets which meant we had to make compromises.
  • #6: A Junit could be written as what you see here. The developer probably only had a design document on how the class should behave and what methods they had to write. So then they would write a test like that. So what would happen if this junit would fail? What would you know if you looked at a junit report that said SelectPrice failed? Problems – if the test failed, how do you have to spend time investigating what particular functionality failed. You would have to go into the test and see what it really tested. Whether you absolutely have to fix it depends on which requirement it reflects. How its not so easy to determine which requirement it is for. The wording does not reflect the requirements or the desired behaviour of the system So BDD attempts to address this focusing on the behaviour of the system. We went from having requirements the system will do something to something like As a user, I want to be able to find out the highest price for a security so that I charge the most for my portfolio. The tests then we organised in the given some precondition, when some action is called, then I expect something to happen and the method name is something a bit more meaningful so that if you looked at a junit report, when it fails, I know have a better indicator what failed.
  • #7: FitNesse is an Acceptance Testing Framework with a wiki as the front end, some fixtures or glue code that invokes your system / functions or what we call the System Under Test. There are a couple of other good testing frameworks such as Cucumber, Jbehave, Concordion and so on. We choose FitNesse because it was the easiest for our BAs to use. But I have to admit, some of the other tools might be closer to BDD than FitNesse. Given some prices, when we compare prices and generate the report, then we expect no differences with a predefined report.
  • #8: Your tests are there to save you money, but they aren’t free. Tests come at a cost. If the cost is greater than what they save you, are they worth it? It costs you money to write tests, maintain them, debug and fix them. Even looking at them costs you money. What if your client whats a piece of functionality in production next week? Can you do it? What about tomorrow? What can you confidently say you’ve tested everything? Are your tests holding you back? If you have a test that fails, do you believe it has failed immediately or do you rerun it first? That rerun is wasted effort. If a test passes, do you believe that functionality works or do you have a poke around at the GUI first? Then there is the people side of things. You ask someone to investigate a test failure, do they groan? Can a new joiner into the team start investigating and writing their own tests relatively quickly?
  • #9: Is it cheaper to fix the problem before or after its released into production? What if you hold up production? Costs of breaking contractual agreements. You should also ask why didn’t your tests pick up the problem earlier. If a bug is found so late in the cycle, will it costs more to fix before releasing to production due to costs? Time to fix it? How long to retest? If you have not got a release process clearly defined, then it will take you a while to release from DEV to SIT and then UAT. Are the creation of your release packages for different test environments standardized? You need to ensure that what you deploy to each environment, from your build servers to SIT and UAT is the same. So you need to ensure everything is scripted and theres no manual copying of files anywhere. There is a whole lot of things you can do around DevOps to help you here but is beyond the topic today. The project I’m on used to take 2 to 4 hours to deploy to an environment. Anything could go wrong, locking out accounts to copying the wrong set of files and manual copying and unzipping files. We were copying files across continents – from UK to Hong Kong. Now we have it all automated to deploy to 2 Linux servers and 4 Window servers across Hong Kong in under 5 minutes.
  • #10: One indicator that your tests are costing you is what do you after they’ve failed. Do you trust your reporting well enough to verify it’s a real break? If it is a real break, how long does it take you to get started to look into it? Are there sufficient debug statements and logs? We will see some more examples of things that take up time investigating broken tests And then, was the test broken because of some environment issue? Is it connecting to a database or MQ which happened to be down? Then the test is just creating noise as you don’t know whether the actual function being tested broken or not. A lot of computation heavy methods take time. Did you introduce a wait or delay into your test? What if one day, the environment is a little bit slower than normal? Most of the time, you don’t plan for tests to be ran in parallel. Whoever wrote the first couple of Junits in the system just wrote tests. They probably didn’t think about running tests in parallel or other performance issues. So its possible that some data might be reused across tests. If you’re running tests in parallel, would you have the problem of over writing each others data?
  • #11: So now lets look at examples of what I just talked about. From the test, how long does it take for you to just look at where the failures are? If its hidden in a file, you have to go the file system and check the reports. In Fitnesse, you can reuse pages so you can have a page with just the test data so that if the data needs to change, you can just change that one test page.
  • #12: Discuss the use of valuation_date and the wait for 1 minute What if other pages also use 1st march? How are you going to run them in parallel? Are you going to setup VMs? Separate folders per process? The simplest thing you could at least do is agree with others on what date you will use so that you don’t over lap. Changes are, that’s going to be a real quick way to solve some of your issues. The wait for 1 minute, what if the compare prices takes longer than 1 minute? What are things you can try? 90 seconds? 2 minutes? What if the operation really did fail? Then you have to wait 2 minutes. What if you poll? Say 3 seconds for 30 rounds? If it passes, then you’ve sped up the test. But what if it fails? Then you are still waiting a long time. Can you change to event driven architecture? That is most ideal solution, but probably not feasible.
  • #13: Continuing from the previous example, most of the time, large processes and engines are often put into threads which makes it asynchronous. How many times do you need to test the actual engine or can you extract the logic inside the thread. In the ideal situation, you will have unit tests covering each function and perhaps each class and then a small number of FitNesse tests that represent integration tests.
  • #14: How well do you trust the coverage %? What does it mean? If you only cover unit tests, then you are missing out on the integration. Still need ways to unsure that testing covers everything? Can have Excel or tools like QC that people put in test cases. If an automatic test suite passes, is that sufficient or do you still have a whole lot of manual testing to go?
  • #15: If this is a problem, then you have a problem. Is it easy for people to add new tests? Often the first thing most people do is look for a working example and then copy and paste it and then change the values they need. But how do you know whether they are copying a test that is up to date with the methods being called? What usually happens is that people write some tests that passes. Then some people add some new utilities or things that make the tests work better but the old tests don’t get updated. You need to come up with a system that ensures people are copying the most up to date tests. I have not got a silver bullet for this issue. In an ideal world, all tests are up to date. But in reality, we have code reviews and owners for test suites who know which test are up to date. Not only do we need to keep the code up to date, the documentation needs to be there and kept up to date. I always follow the DRY – Don’t Repeat Yourself principle. Ideally everyone will remove duplication but in reality, it doesn’t always happen. You always build up on debt.
  • #16: The solution is easy – invest time to clean it up. Lets say you package the structure a little better and created a report package and put the report related classes inside. Then inside the documentation for those classes, you don’t need to explicitly say those are reporting classes. Simply by being in the package, you know it’s a reporting related class. You’ve made life easier for yourself. And then same if you refactor methods as well. You’ve reduced the number of things that need documentation.
  • #17: Mocking allows you to simulate behaviour. Rarely does your class work alone (unless it’s a really bad class) or it’s a toy. But when you are testing just one class or component, you really need to be able to simulate it communicating with other classes and interfaces. You don’t want to connect to the database or file system everytime you test because its slow and you are introducing more variables into the test environment. And you also need to be able to repeat the behaviour over and over again and make sure everytime the inputs into the test are the same. But Mocking itself is not the answer to everything. Frameworks can easily be abused and you will end up with a mess. Often testing frameworks require you to mock out each method call and potentially there could be nested mock objects.
  • #18: First example – create the objects required for testing inside the test. You can see it can get quite complicated, what if your objects have dependencies you aren’t testing? Your tests can get quite long, full of code that isn’t actually needed for the test but required for the setup Second example – an object mother – huge improvement by using factories. Hides all the details. But if the test fails, you have to dig into the object mother to see what the object looks like (wasting time on figuring out what is wrong). What if you have a slightly different object? Then you need a new method Third example – test object builders. The test is more verbose but more elegant. You can hide dependencies that you don’t care about inside the .with() methods or upon initialisation of the builder object, set a whole lot of default fields.
  • #19: (skip this slide if not enough time) Chances are the vendor software is doing something complex, if it was simple, you may not have purchased it. And therefore it will have complex data requirements and messages flowing in and out of the system. If you are programming in a language that compiles like Java, then using the Vendor’s API will give you some clue that changed in a version upgrade.
  • #20: Everything I have talked about so far are a symptom, not the cause of why you are having trouble with your tests. The root cause in my opinion is the people. All the software packages like FitNesse and Mocking and theory like test boundaries I have talked about ultimately get used by people. And it is how your people choose to use these things that ultimately get you into a mess. What if your people don’t believe in testing? Have they seen the benefits? Or are they just feeling the pain of cleaning up a messy test suite? If the benefit is all at the management level, why would you expect at the individual contributors to fully embrace testing? Gamification – could back fire if moral is low. Example – 2 teams, manager publishes some statistics that he wants to measure and introduces a little competition against each other. But if moral is low, or the incentives are low, then no one cares. Everyone will want to beat the game. Eg ratio of emergency releases into production to releases is a low percentage. I don’t have a solution for people problems – but are you even aware of it?