testing chapter 10. types of testing test typeensures that unit testeach independent piece of code...

14
Testing Chapter 10

Upload: colleen-erica-carson

Post on 03-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

TestingChapter 10

Page 2: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

Types of Testing

Test type Ensures that

Unit test Each independent piece of code works correctly.

Integration test All units work together without errors.

Regression test Newly added features do not introduce errors to other features that are already working.

Load test (also called stress test)

The product continues to work under extreme usage.

Platform test The product works on all of the target hardware and software platforms.

Page 3: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together
Page 4: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

Unit Testing with NUnit

See http://www.byte-vision.com/NUnitAnd

VBArticle.aspx

Page 5: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

NUnit

• Unit testing framework

• Market standard automated testing tool

• Imported from JUnit

• Free tool

• Written in C#

• See http://www.nunit.org

Page 6: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

Demo: Using NUnit

1. Create a VB.NET solution 1. Code Classes

2. Test Class

2. Set up Test

3. Write basic test

4. Write exception test

5. Run test using NUnit GUI

Page 7: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

Add a nUnit Test button to a toolbar (VS 2005)

1. Tools | External Tools

Page 8: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

2. External Tools Dialog

Page 9: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

3. Edit Custom Tools Dialog

nunit-guiOr

nunit-console

Page 10: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

(Put a nUnit button on a toolbar)4. Tools | Customize

Page 11: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

5. Commands | Tools | External Command 2

Drag and drop onto a toolbar

Page 12: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

6 Voila!

Page 13: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

The Account Class

RULES:

• Overdraft limit must be positive

• Amount withdrawn or deposited must be greater than zero

• Cannot withdraw over the overdraft limit

Page 14: Testing Chapter 10. Types of Testing Test typeEnsures that Unit testEach independent piece of code works correctly. Integration testAll units work together

Demo

• Project: AccountVB– Class: Account.vb (review)

• Reference to nUnit.Framework• Using Nunit.framework• TestFixture Attribute• Setup/Teardown Attributes• Test attributes• Red, Green, Yellow indicators• Withdraw test• Exception Test