Download presentation
Presentation is loading. Please wait.
Published byGodwin Johns Modified over 9 years ago
1
By: Taylor Helsper
2
Introduction Test Driven Development JUnit Testing Private Methods TDD Example Conclusion
3
What is this lecture? ◦ Part of a CSE 4000 Independent Study Course ◦ “Practical Issues in Software Engineering” What’s the point? ◦ To provide practical information to students in Software Engineering topics Note: The products discussed in this presentation are examples used for teaching purposes and are not endorsements of the products.
4
Introduction Test Driven Development JUnit Testing Private Methods TDD Example Conclusion
5
What is it? ◦ Development/Testing process where tests are generated before the development ◦ Development is completed based on the tests
6
Why is it useful? ◦ Distinct Steps ◦ Good Metrics ◦ Ensures Completion Based on Requirements/Design
7
Why is it useful? ◦ Only necessary features are implemented ◦ Short Development Lifecycle ◦ Easy to Accommodate Changes
8
Steps ◦ Write tests based on design / requirements ◦ Write code ◦ Run tests ◦ Repeat until all tests pass
9
http://en.wikipedia.org/wiki/Test-driven_development
10
Introduction Test Driven Development JUnit Testing Private Methods TDD Example Conclusion
11
What is it? ◦ JUnit is a testing framework for Java ◦ It allows programmers to write test cases for Java classes
12
Why use it? ◦ Repeatability ◦ Metrics / Measurement ◦ Easy Integration
13
A JUnit Test Case
14
JUnit Before/ After
15
Introduction Test Driven Development JUnit Testing Private Methods TDD Example Conclusion
16
Why? ◦ Better Tests ◦ Higher Probability Errors are Found ◦ Meet Regulations Testing Standards Code Coverage
17
How? ◦ Use Reflection ◦ Java classes know info about themselves Functions Variables
18
Java Example ◦ Get Private Access
19
Java Example ◦ Test Private Method
20
Introduction Test Driven Development JUnit TDD Example Conclusion
21
Math Class for a Calculator Program Steps ◦ Generate Tests ◦ Code ◦ Run Tests ◦ Repeat
22
Test Driven Development is important to understand TDD is useful in many circumstances TDD ◦ Saves Money ◦ Is Agile ◦ Offers Good Metrics
23
Junit - http://www.junit.org/http://www.junit.org/ Netbeans – http://netbeans.org/http://netbeans.org/ JUnit Examples - http://junit.sourceforge.net/doc/cookbook/cookbook.htm http://junit.sourceforge.net/doc/cookbook/cookbook.htm MSU Classes and work experience Stack Overflow for Reflection Code - http://stackoverflow.com/questions/34571/whats-the-best-way-of- unit-testing-private-methods http://stackoverflow.com/questions/34571/whats-the-best-way-of- unit-testing-private-methods Real’s How To for Reflection Code - http://www.rgagnon.com/javadetails/java-0031.html http://www.rgagnon.com/javadetails/java-0031.html “Subverting Java Access Protection for Unit Testing” by Ross Burton. 11/12/2003. onjava.com.onjava.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.