Testing Steve Loughran HP Laboratories June 9th, 2008
About me
I break things for a living
this is because I am clumsy
breaking other people’s code is fun
sometimes it is really hard
Ant in Action
the problems of complex builds in big teams
not for this course
stay in the IDE
testing is key to getting big projects out the door
automation comes next
your code doesn't work
I know this because...
my code doesn't work
it's OK to write code that doesn’t work
but not to ship it
especially when it matters
how do you get from "broken" to "shipping"?
Device Drivers ship and see test it! Test-Driven x: y : f ( y , x) > 0 Formal Methods prove it works
proofs of correctness
shows an algorithm really works
good for concurrency
and other things you can’t test
makes assumptions about system
needs lots of maths/CS skills (Pi-Calculus, The HOL System)
how do you do regression proofs?
Testing: code that breaks
unit test: test classes, libraries
functional test: test the application
system test: test a deployed system
performance test: simulate load.
acceptance tests: is it ready for use?
a good test breaks the build!
Test Driven Development any feature without a test doesn’t exist
Lots of unit test frameworks
Java: JUnit, TestNG
Python: PyUnit
Ruby: Test:: Unit
.NET: NUnit
PHP: PHPUnit
C++ (CppUnit)
JUnit
main unit test framework in Java (see also TestNG)
simple to learn
good tool support
somewhat low-level
extensions for system testing
public class LessSimpleTest extends TestCase { public LessSimpleTest (String s) { super(s); } public void testAssignment() { final Date date = new Date(); Event event = new Event(UUID.randomUUID(), date, "now", "Text"); assertEquals("self equality failed", event, event); assertEquals(date, event.getDate()); assertNotNull(date.getID()); } }
swing GUI TestRunner
Ant-generated report scales better; reports published
0 comments
Post a comment