Unit Testing Essentials using JUnit and EasyMock (TT3520)
About This Course
Unit Testing Essentials using JUnit and EasyMock is a three-day, comprehensive hands-on unit testing training course geared for developers who need to get up and running with essential unit testing skills using JUnit, EasyMock, and other tools. Throughout the course students learn the best practices for writing great programs in Java, using unit testing techniques. This comprehensive course also covers essential TDD topics and skills.
Audience Profile
This is an intermediate-to-advanced level Java course, designed for developers who wish to get up and running on test-driven development immediately. Attendees should be familiar with Java and object-oriented technologies. Real world programming experience is a must.
Take Before: Students should have basic development skills and experience in the following topics, or attend these courses as a pre-requisite:
- TT2100 Mastering Java for OO Developers
- Recommended but not required: TT5100: Mastering JEE Web Application Development
At Course Completion
Working within in a dynamic, learning environment, guided by our expert TDD team, attendees will::
- Understand what unit testing is and what it is not intended to cover
- Understand JUnit.
- Understand and use the JUnit Test Runner interface.
- Use JUnit to drive the implementation of Java code.
- Test applications using native IDE support.
- Best practices and patterns for unit testing.
- Understand JUnit’s strengths and weaknesses
- Understand the role of debugging when done in conjunction with tests.
- Understand not only the fundamentals of the TDD using Java, but also its importance, uses, strengths and weaknesses.
- Understand how JUnit affects your perspective on development and increases your focus on a task.
- Learn good JUnit coding style.
- Create well structured JUnit programs.
- Understand how JUnit testing can be used for either state-based or interaction-based testing.
- How to extend testing with mock objects using EasyMock.
- Look at refactoring techniques available to make code as reusable/robust as possible.
- Discuss various testing techniques.
Course Outline
Session: JUnit
Lesson: JUnit Overview
• Purpose of Unit Testing
• Good Unit Tests
• Test Stages
• Unit Testing Vs Integration Testing
Lesson: Jumpstart: JUnit 4.x
• JUnit Overview
• How JUnit Works
• Launching Tests
• Test Suites
• JUnit Test Fixture
Lesson: @Test Annotation
• Test Execution Cycle
• Checking for Exceptions
• Using Timeouts
Lesson: Hamcrest
• About Hamcrest
• The Hamcrest Matcher Framework
• Hamcrest Matchers
Lesson: Parameterized Tests
• Injecting the Parameters
• Setting the Parameters
• Test Execution Cycle
• Observations
Lesson: Theories
• Writing Theory Enabled Tests
• Defining DataPoints
• Defining Theories
• Observations
Lesson: JUnit Best Practices
• "Good" Tests
• Bad Smells
• White-Box Unit Testing
• Black-Box Unit Testing
• Automation and Coverage
Session: Testing Tools and Techniques
Lesson: Improving Code Quality Through Refactoring
• Refactoring Overview
• Refactoring and Testing
• Refactoring to Design Patterns
• Naming conventions
Lesson: Mocking of Components
• Why We use Test Dummies
• Mock Objects
• Working with Mock Objects
• Using Mocks with the User Interface
• Mock Object Strategies
Lesson: Mock Objects and EasyMock
• EasyMock Description and Features
• EasyMock Object Lifecycle
• Create/Expect Phase
• Replay/Verify Phase
• Mocking Complex Objects
• EasyMock HOWTO
Lesson: PowerMock
• PowerMock Description and Features
• PowerMock Object Lifecycle
• Mocking a Static Method
Appendix: Adding Testing to the Build Process
• JUnit and Ant
• The Ant JUnit Tag
• Running JUnit Tests From Ant
• Generating a JUnitReport
Sorry! It looks like we haven’t updated our dates for the class you selected yet. There’s a quick way to find out. Contact us at 502.265.3057 or email info@training4it.com
Request a Date