testing - the apache software foundationpeople.apache.org/~stevel/slides/testing.pdf · system...

24
Testing Steve Loughran HP Laboratories Thursday November 6th, 2006

Upload: others

Post on 25-May-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Testing

Steve LoughranHP LaboratoriesThursday November 6th, 2006

Page 2: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

your code doesn't work

Page 3: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

i know this because...

Page 4: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

my code doesn't work

Page 5: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

it's OK to write code that doesn’t work

Page 6: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

just don’t ship it

Page 7: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

especially if it matters

Page 8: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

how do you get from "broken" to "shipping"?

Page 9: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Device Drivers

ship and see

test it!

Test-Driven

∃x:(∀y∈[1..x]:f(y)>0)

Formal Methods

prove it works

Page 10: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

proofs of correctness

+ shows an algorithm really works+ good for concurrency+ and distributed things

- makes assumptions about system- needs lots of maths/CS skills(Pi-Calculus, The HOL System)

- regression proofs?

Page 11: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Test Driven Development

any feature without a test doesn’t exist

Page 12: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

JUnit

* unit test framework in Java -versions for C++, Python, Ruby...

* simple to learn* good tool support* somewhat low-level* extensions for system testing

Page 13: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database
Page 14: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

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());

}}

Page 15: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

swing GUI TestRunner

Page 16: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Ant-generated report

scales better; reports published

Page 17: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Continuous Integration

Page 18: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

System Testing

* deploy, then:HttpUnit, XmlUnit, Cactus

* needs automated deployment, database setup, teardown

* performance testing by comparing timings w.r.t. old runs

* Simulate entire behaviour of the client user/application

Page 19: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Distributed System Testing

* Still a research topic

* Set up complex configurations* Run tests on remote machines* collect results and log data* Post-mortem analysis* Virtualization can help

see http://tinyurl.com/y99tez

Page 20: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

limitations of testing

- good tests are hard to write- distributed tests very hard- different system configurations are still a problem

- status of "tester" below "coder"

A good test breaks the application-–-––––-–--–-----------------------------------------

Page 21: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

politics:resistance to change

Page 22: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

developers: ignorance, fear

E.E.E. Educate, Evangelise, Encourage

* gently show benefits* use testing to track down a bug* retain test for regression testing* add tests for new code and old problems, not existing codebase

* adopt cruise control, reporting

Page 23: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

management: ignorance

"too much time spent on testing"

* out of date with modern processes* belief that testing slows the schedule (only if you follow the ship-and-see process)

E.E.E., then D.D.D: Distract, Dissemble, Defeat

Page 24: Testing - The Apache Software Foundationpeople.apache.org/~stevel/slides/testing.pdf · System Testing *deploy, then: HttpUnit, XmlUnit, Cactus *needs automated deployment, database

Test Driven Standards?

any standard without a test doesn’t exist