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. INTRO
1. The Dark Side
2. Padawan’s path
3. Use the Tests
4. Test practices
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
14. SOFTWARE LIFECYCLE MANAGEMENT
AGILE MANIFESTO
▸Based on 12 principles
▸Individuals and interactions
▸Working Software
▸Customer collaboration
▸Responding to change
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. 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?
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
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
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
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.
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
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
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. 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. 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. 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