MS3: 2a: Intro to Unit TestingOnline version Java concepts, terms and conditions by steve finch 1 Unit Testing 2 Blackbox Testing 3 Glass Box Testing 4 Stateful Components 5 Stateless Components 6 TDD 7 JUnit Used to test lowest level components of an application Is responsibility of software developer for each class they create Is usually done with an automated framework like JUnit Tests component's functionality only Knows nothing of the component's specific implementation Tests the interface Ensures that a component does what it promises to do Also known as White Box Testing Takes a component's implementation into account Each code path through a component is exercised Have a state Cause side effects Result may differ depending on what happened previously Care must be taken to put them into a known good state before testing Have no state Cause no side effects Act like a math function Always produce the same result Include all static methods in Java Math class Test Driven Development Also known as Red/Green/Refactor Component unit tests are written before actual implementation Only the interfaces and shell implementation are written before unit tests the de facto standard automated unit test framework in Java Has good integration with Netbeans, Eclipse, IntelliJ, and Maven If any unit tests fail, the build fails Makes it easy to create unit tests suites for Java components