Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
TESTINGI FIND YOUR LACK OF TESTS
DISTURBING
WHAT IS TESTING?
YOU SAY WHILE YOU NAIL IN MY PUPIL YOUR
PUPIL IN BLUE.
WHAT IS TESTING?
AND YOU ASK TO ME? TESTING… IS YO...
INTRO
1. The Dark Side
2. Padawan’s path
3. Use the Tests
4. Test practices
THE DARK SIDE
THE DARK SIDE
▸Companies
▸Want to reduce costs
▸Saving time -> reducing plans
▸Saving money -> reducing salaries
▸Develope...
LIFECYCLE
MANAGEMENT
WATERFALL
LIFECYCLE
SOFTWARE LIFECYCLE MANAGEMENT
WATERFALL: A TRADITIONAL ENGINEERING APPROACH
REQUIREMENTS
ANALYSIS
SOFTWARE
DESIGN
IMPLEMEN...
V-MODEL
LIFECYCLE
SOFTWARE LIFECYCLE MANAGEMENT
V-MODEL: AN EXTENDED WATERFALL
REQUIREMENTS
ANALYSIS
SYSTEM
DESIGN
IMPLEMENTATION
INTEGRATIO...
SPIRAL
LIFECYCLE
SOFTWARE LIFECYCLE MANAGEMENT
SPIRAL: CYCLES OF MINI-WATERFALLS
SOFTWARE
DESIGN
CODE
TESTING
INTEGRATION
IMPLEMENTATION
OB...
AGILE
LIFECYCLE
SOFTWARE LIFECYCLE MANAGEMENT
AGILE MANIFESTO
▸Based on 12 principles
▸Individuals and interactions
▸Working Software
▸Cus...
SOFTWARE LIFECYCLE MANAGEMENT
AGILE MANIFESTO
▸Working software is the principal
measure of progress
▸Welcome changing req...
SOFTWARE LIFECYCLE MANAGEMENT
AGILE MANIFESTO
▸Working software: How do you assert
that?
▸Changing requirements: How do yo...
PADAWAN’S PATH
PADAWAN’S PATH
▸Include Testing activities the
soonest
▸Developers HAVE TO write tests
▸Do not treat QA as the next team
i...
TEST EARLIER
AND MORE
BEST PRACTICE 1
PADAWAN’S PATH: WRITE TESTS EARLIER
▸Removes fear of changes
▸Executable examples/documentation
▸Enables refactoring
▸Help...
DEVELOPERS
WRITE TESTS
BEST PRACTICE 2
▸Unit, Integration and functional tests
▸Do not fall in the fallacy of automate
everything: Automate critical things
▸This...
TREAT QA NOT AS
“THE QA GUYS”
BEST PRACTICE 3
http://sauceio.com/wp-content/uploads/2016/08/blog-post-600x451.png
▸Otherwise, QA finds bugs when it’s
expensive
▸QA are team members
▸Spread the knowledge with them:
involve them in daily m...
USE THE TESTS
UNIT
TEST TYPES
UNIT TESTS
▸Isolated code
▸Executed fast
▸Always automated
▸I.e.: utility classes, POJO’s
▸Book: “Effective Unit Testing” ...
UNIT TESTS: MOCKS
▸Mocks
▸Isolate code
▸Speed up test execution
▸Simulate special conditions
UNIT TESTS: MOCKS
▸Stub: objects which return a specific value.
▸Fake Object: simpler than real implementation
but more ela...
UNIT TESTS: MOCKS
▸Mocks
▸Increase complexity/
maintainability
▸Careful with wrong behaviour
▸Too much expectations
▸Corpo...
INTEGRATION
TEST TYPES
INTEGRATION TESTS
▸Code depending on other
(module, component, service…)
▸Not executed that fast
▸I.e. database, file syste...
END-TO-END
TEST TYPES
END-TO-END TESTS: PROS
▸Loved by management
▸Simulates user behaviour
▸Black-box testing
END-TO-END TESTS: DRAWBACKS
▸Difficult root cause analysis
▸Small errors can hide real problems
▸Slow execution
▸Report bug...
MANUAL TESTS
UI TESTS
INTEGRATION
UNIT
MANUAL TESTS
UI TESTS
INTEGRATION
UNIT70%
20%
10%
SMOKE
TEST TYPES
SMOKE TESTS
▸Define critical paths on
your end-to-end tests
▸Execute it as a minimal
proof of working software
▸Always auto...
EXPLORATORY
TEST TYPES
EXPLORATORY TESTING
▸You need knowledge of the system
▸Knowledge increases while you test
▸It’s not automated
▸Relay on hu...
PERFORMANCE
TESTING TYPES
PERFORMANCE
▸Stress or capacity testing
▸Physically separated machines
▸A typical configuration:
▸Injector, Database, Appli...
OTHER TESTS
TESTING TYPES
OTHER TESTS
▸Behaviour (BDD)
▸Usability
▸Security
▸Comparison
▸Alpha/Beta
▸…
TEST PRACTICES
TEST PRACTICES
▸A @Test should have only one
reason to fail
▸A @Test should check just one
thing
▸A good commentary explai...
TEST PRACTICES
▸Avoid conditional logic in tests
▸A constantly falling @Test is useless
▸A @Test that cannot fail has no
v...
UNTRUSTWORTHY TESTS
// does not test anything
public void testFoo() {
MyStaticClass.foo();
}
// does not do anything
publi...
TEST PRACTICES
▸Write platform independent tests
▸Flaky tests that fail intermittently as
usually related to I/O
▸Do not h...
PREMATURE OPTIMISATION
AND DUPLICATION ARE THE
ROOT OF ALL EVIL
Lasse Koskela. “Effective Unit Testing”
TEST PRACTICES
DUPLICATION IN TESTS COULD
BE GOOD IN FAVOUR OF
IMPROVED READABILITY
Lasse Koskela. “Effective Unit Testing”
TEST PRACTICES
MAY THE TEST
BE WITH YOU
Upcoming SlideShare
Loading in …5
×

Testing 101

237 views

Published on

An introduction about Software testing, testing types, and some tips when testing (and coding in general)

Published in: Software
  • Login to see the comments

Testing 101

  1. 1. TESTINGI FIND YOUR LACK OF TESTS DISTURBING
  2. 2. WHAT IS TESTING? YOU SAY WHILE YOU NAIL IN MY PUPIL YOUR PUPIL IN BLUE. WHAT IS TESTING? AND YOU ASK TO ME? TESTING… IS YOU. To the unknown developer… INTRO
  3. 3. INTRO 1. The Dark Side 2. Padawan’s path 3. Use the Tests 4. Test practices
  4. 4. THE DARK SIDE
  5. 5. THE DARK SIDE ▸Companies ▸Want to reduce costs ▸Saving time -> reducing plans ▸Saving money -> reducing salaries ▸Developers ▸feel pressured and don’t have time to test ▸don’t want to test or to learn how to test ▸I’m not going to talk about salaries so let’s talk about technical things
  6. 6. LIFECYCLE MANAGEMENT
  7. 7. WATERFALL LIFECYCLE
  8. 8. SOFTWARE LIFECYCLE MANAGEMENT WATERFALL: A TRADITIONAL ENGINEERING APPROACH REQUIREMENTS ANALYSIS SOFTWARE DESIGN IMPLEMENTATION TESTING INTEGRATION DEPLOYMENT MAINTENANCE https://en.wikipedia.org/wiki/Software_development_process DOCUMENT IT !!
  9. 9. V-MODEL LIFECYCLE
  10. 10. SOFTWARE LIFECYCLE MANAGEMENT V-MODEL: AN EXTENDED WATERFALL REQUIREMENTS ANALYSIS SYSTEM DESIGN IMPLEMENTATION INTEGRATION VALIDATION MAINTENANCE CONCEPTS OF OPERATIONS INTEGRATION VALIDATION MAINTENANCE TESTING UNIT INTEGRATION FUNCTIONAL https://en.wikipedia.org/wiki/V-Model_(software_development) TIMELINE
  11. 11. SPIRAL LIFECYCLE
  12. 12. SOFTWARE LIFECYCLE MANAGEMENT SPIRAL: CYCLES OF MINI-WATERFALLS SOFTWARE DESIGN CODE TESTING INTEGRATION IMPLEMENTATION OBJECTIVES RISKS PLAN https://en.wikipedia.org/wiki/Software_development_process
  13. 13. AGILE LIFECYCLE
  14. 14. SOFTWARE LIFECYCLE MANAGEMENT AGILE MANIFESTO ▸Based on 12 principles ▸Individuals and interactions ▸Working Software ▸Customer collaboration ▸Responding to change
  15. 15. SOFTWARE LIFECYCLE MANAGEMENT AGILE MANIFESTO ▸Working software is the principal measure of progress ▸Welcome changing requirements, even in late development ▸Continuous attention to technical excellence and good design
  16. 16. SOFTWARE LIFECYCLE MANAGEMENT AGILE MANIFESTO ▸Working software: How do you assert that? ▸Changing requirements: How do you verify you don’t break existing things? ▸Good design: Are you able to easily test it?
  17. 17. PADAWAN’S PATH
  18. 18. PADAWAN’S PATH ▸Include Testing activities the soonest ▸Developers HAVE TO write tests ▸Do not treat QA as the next team in the line
  19. 19. TEST EARLIER AND MORE BEST PRACTICE 1
  20. 20. PADAWAN’S PATH: WRITE TESTS EARLIER ▸Removes fear of changes ▸Executable examples/documentation ▸Enables refactoring ▸Helps you understand design ▸It’s not slower: faster and more robust ▸Visual feedback: red & green
  21. 21. DEVELOPERS WRITE TESTS BEST PRACTICE 2
  22. 22. ▸Unit, Integration and functional tests ▸Do not fall in the fallacy of automate everything: Automate critical things ▸This is not removing QA team: they automate things and specialise in Exploratory Testing PADAWAN’S PATH: DEVELOPERS WRITE TESTS
  23. 23. TREAT QA NOT AS “THE QA GUYS” BEST PRACTICE 3
  24. 24. http://sauceio.com/wp-content/uploads/2016/08/blog-post-600x451.png
  25. 25. ▸Otherwise, QA finds bugs when it’s expensive ▸QA are team members ▸Spread the knowledge with them: involve them in daily meetings, demos… ▸Result? Enables Exploratory Testing PADAWAN’S PATH: THE IMPORTANCE OF QA TEAM
  26. 26. USE THE TESTS
  27. 27. UNIT TEST TYPES
  28. 28. UNIT TESTS ▸Isolated code ▸Executed fast ▸Always automated ▸I.e.: utility classes, POJO’s ▸Book: “Effective Unit Testing” Lasse Koskela
  29. 29. UNIT TESTS: MOCKS ▸Mocks ▸Isolate code ▸Speed up test execution ▸Simulate special conditions
  30. 30. UNIT TESTS: MOCKS ▸Stub: objects which return a specific value. ▸Fake Object: simpler than real implementation but more elaborated than a stub. ▸Spy Object: registers what is being executed in a test. ▸Mock: a more powerful spy object.
  31. 31. UNIT TESTS: MOCKS ▸Mocks ▸Increase complexity/ maintainability ▸Careful with wrong behaviour ▸Too much expectations ▸Corporate mocks
  32. 32. INTEGRATION TEST TYPES
  33. 33. INTEGRATION TESTS ▸Code depending on other (module, component, service…) ▸Not executed that fast ▸I.e. database, file system, modules..
  34. 34. END-TO-END TEST TYPES
  35. 35. END-TO-END TESTS: PROS ▸Loved by management ▸Simulates user behaviour ▸Black-box testing
  36. 36. END-TO-END TESTS: DRAWBACKS ▸Difficult root cause analysis ▸Small errors can hide real problems ▸Slow execution ▸Report bugs that could have been fixed before ▸Super hard maintenance
  37. 37. MANUAL TESTS UI TESTS INTEGRATION UNIT
  38. 38. MANUAL TESTS UI TESTS INTEGRATION UNIT70% 20% 10%
  39. 39. SMOKE TEST TYPES
  40. 40. SMOKE TESTS ▸Define critical paths on your end-to-end tests ▸Execute it as a minimal proof of working software ▸Always automated
  41. 41. EXPLORATORY TEST TYPES
  42. 42. EXPLORATORY TESTING ▸You need knowledge of the system ▸Knowledge increases while you test ▸It’s not automated ▸Relay on human experience and knowledge ▸Use test methods ▸Book: “Explore it!” E.Hendrickson
  43. 43. PERFORMANCE TESTING TYPES
  44. 44. PERFORMANCE ▸Stress or capacity testing ▸Physically separated machines ▸A typical configuration: ▸Injector, Database, Application, Console ▸Very hard or specialised ▸Periodically executed ▸Tools: jMeter, Grinder, LoadRunner
  45. 45. OTHER TESTS TESTING TYPES
  46. 46. OTHER TESTS ▸Behaviour (BDD) ▸Usability ▸Security ▸Comparison ▸Alpha/Beta ▸…
  47. 47. TEST PRACTICES
  48. 48. TEST PRACTICES ▸A @Test should have only one reason to fail ▸A @Test should check just one thing ▸A good commentary explains why, not what
  49. 49. TEST PRACTICES ▸Avoid conditional logic in tests ▸A constantly falling @Test is useless ▸A @Test that cannot fail has no value (false sense of security) ▸A @Test promising more than it delivers is untrustworthy
  50. 50. UNTRUSTWORTHY TESTS // does not test anything public void testFoo() { MyStaticClass.foo(); } // does not do anything public void testFoo() { //new MyClass().foo() } // promise much more than expected public void testSendEmailAfterLogin() { new MyClass().foo() }
  51. 51. TEST PRACTICES ▸Write platform independent tests ▸Flaky tests that fail intermittently as usually related to I/O ▸Do not hardcode test-dependencies ▸Delete/close resources in @Before/ @After methods
  52. 52. PREMATURE OPTIMISATION AND DUPLICATION ARE THE ROOT OF ALL EVIL Lasse Koskela. “Effective Unit Testing” TEST PRACTICES
  53. 53. DUPLICATION IN TESTS COULD BE GOOD IN FAVOUR OF IMPROVED READABILITY Lasse Koskela. “Effective Unit Testing” TEST PRACTICES
  54. 54. MAY THE TEST BE WITH YOU

×