Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer...
-
Upload
clemence-weaver -
Category
Documents
-
view
213 -
download
0
Transcript of Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer...
![Page 1: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/1.jpg)
Testing in Extreme Programming
By Mong-Hang Vo
CS 240 Software ProjectMaster of Science in Computer
ScienceSan Jose State University
December 03, 2003Professor Badrul Sarwar
![Page 2: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/2.jpg)
Agenda
Testing in XP Overview JUnit Framework
![Page 3: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/3.jpg)
Rules and Practices of XP Planning Designing Coding
Code the unit tests first Testing
![Page 4: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/4.jpg)
Coding The Unit Tests First Create one test to define some small
aspect of the problem Then create the simplest code that will
make that test pass Then create a second test Add to the code you just created to make
this new test pass … Continue until there is nothing left to
test.
![Page 5: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/5.jpg)
Coding The Unit Tests First Give a better idea of what features
need to be in a class Immediate feedback Easier and faster to create your
code No need to create them after the
code Save you a lot of time.
![Page 6: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/6.jpg)
Testing in XP Unit Tests Acceptance Tests.
![Page 7: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/7.jpg)
Testing in XP All code must have unit tests All code must pass unit tests
before it can released When a bug is found tests are
created Acceptance tests are run often and
the score is published.
![Page 8: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/8.jpg)
Unit Tests Majority of the testing in XP is unit
testing Unit tests XP style
Download a unit test framework to be able to create automated unit tests suites
Test all classes in the system Create your tests first before coding
Unit tests are released into the code repository along with the code they test.
![Page 9: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/9.jpg)
Unit tests
Enable Collective Code Ownership Enable refactoring.
![Page 10: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/10.jpg)
Collective Code Ownership Everyone in the development team
owns all the code When a change is required, any
programmer can make the change at any time
More reliable than putting a single person in charge of specific classes.
![Page 11: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/11.jpg)
Refactoring Removing redundant and unused
code Keep the design simple.
![Page 12: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/12.jpg)
Acceptance Tests
Created from user stories provided by the customers
Are black box system tests Should be automated so it can be
run often The implementation and running of
acceptance tests can be done by the Software QA team.
![Page 13: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/13.jpg)
Quality assurance (QA) An essential part of the XP process Can be done by a separate group Can be integrated into the
development team XP requires development to have
much closer relationship with QA
![Page 14: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/14.jpg)
Unit Tests Framework Download
www. XProgramming.com JUnit Framework
http://www.junit.org Developed by Luckily Erich Gamma
and Kent Beck The standard for unit testing in Java.
![Page 15: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/15.jpg)
JUnit Framework A set of classes that allows you to
easily create and run a set of unit tests.
Run unit tests Command line mode JUnit GUI
A test case is usually implemented as a subclass of junit.framework.TestCase
![Page 16: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/16.jpg)
JUnit Framework The execution of a test method in
JUnit follows the model: setUp(); test<method_name>(); tearDown();
Junit distinguishes errors from failures. Failures are anticipated by the assert methods.
These methods compare actual result with expected results.
![Page 17: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/17.jpg)
JUnit Framework If a test fails, execution of the current
test method is aborted. A test case repeats the above model,
using reflection to find all test methods.
Test methods must be public, void, take no arguments, and have a name that starts with "test" (so that reflection can determine which methods to call).
![Page 18: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/18.jpg)
JUnit Framework
![Page 19: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/19.jpg)
JUnit Framework
![Page 20: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/20.jpg)
JUnit Framework Automate unit testing of Java
classes Test code should be documented
with Javadocs. Easier to maintain well-documented
test cases Is an easy-to-use framework.
![Page 21: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/21.jpg)
References http://www.extremeprogramming.org Unit tests Samples in JUnit installation Unit Testing: Test Early, Test Often by
Michael Olan Test first, code later: a guide to
integrating JUnit into development process by Thomas Hammell and Robert Nettleton (sjlibray.org)
![Page 22: Testing in Extreme Programming By Mong-Hang Vo CS 240 Software Project Master of Science in Computer Science San Jose State University December 03, 2003.](https://reader036.fdocuments.net/reader036/viewer/2022070409/56649e735503460f94b72ca6/html5/thumbnails/22.jpg)
Thank You!