Unit Testing Essentials Using Junit 5 and Easymock (With
Total Page:16
File Type:pdf, Size:1020Kb
Trivera Technologies IT Training Coaching Courseware Collaborate. Educate. Accelerate! Unit Testing Essentials using JUnit 5 and EasyMock (with Best Practices) Explore Unit Testing, JUnit, Best Practices, Testing Apps with Native IDE Support, Debugging, Using EasyMock & More w w w . t r i v e r a t e c h . c o m Course Snapshot Course: Unit Testing Essentials using JUnit 5 and EasyMock (TT3524) Duration: 3 days Audience & Skill‐Level: This in an introduction to Unit Testing course for experienced Java developers Language / Tools: This course uses JUnit 5 and EasyMock. This course is also available for JUnit 4, or JUnit 5 and Mocktio. Hands‐on Learning: This course is approximately 50% hands‐on, combining expert lecture, real‐world demonstrations and group discussions with machine‐based practical labs and exercises. Student machines are required. Delivery Options: This course is available for onsite private classroom presentation, live online virtual presentation, or can be presented in a flexible blended learning format for combined onsite and remote attendees. Please also ask about our Self‐ Paced / Video or QuickSkills / Short Course options. Public Schedule: This course has active dates on our live‐online open enrollment Public Schedule. Customizable: This course agenda, topics and labs can be further adjusted to target your specific training skills objectives, tools and learning goals. Please inquire for details. Overview JUnit 5 and EasyMock make it possible to write higher‐quality Java code. These powerful tools are designed to support robust, predictable and automated testing development in the Java enterprise application arena. Unit Testing Essentials using JUnit 5 and EasyMock is a three‐day, hands‐on unit testing course geared for experienced developers who need to get up and running with essential unit testing skills using JUnit, EasyMock, and other tools. Students will leave the course armed with the skills required to leverage solid unit testing practices using the latest industry techniques and best practices. This course quickly introduces developers to the features of JUnit and educates them regarding JUnit’s strengths and weaknesses. Learning Objectives This skills‐centric course is about 50% hands‐on lab and 50% lecture, designed to train attendees in core unit testing skills, coupling the most current, effective techniques with the soundest industry practices. Working in a hands‐on learning environment, guided by our expert team, attendees will learn to: Understand what unit testing is and what it is not intended to cover Understand JUnit 5. 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. The following JUnit‐based testing frameworks are examined: JUnit 5, Mockito and PowerMock Trivera Technologies ● IT Training, Coaching & Courseware Solutions www.triveratech.com ● [email protected] ● toll free 844.475.4559 Unit Testing Essentials with JUnit 5 and EasyMock ● TT3524 2020 ● Page 1 TDD & Trivera Technologies Unit Testing Collaborative IT Training, Coaching & Courseware Solutions Training Series w w w . t r i v e r a t e c h . c o m ● [email protected] Need different skills or topics? If your team requires different topics or tools, additional skills or custom approach, this course may be further adjusted to accommodate. We offer additional unit testing, TDD, BDD, programming, testing tools, test automation, QA, services, security and other related topics that may be blended with this course for a track that best suits your needs. Our team will collaborate with you to understand your needs and will target the course to focus on your specific learning objectives and goals. Audience & Pre-Requisites This programming course is for experienced Java developers. Take Before: Students should have development skills at least equivalent to the following course(s) or should have attended as a pre‐requisite: TT2104 Core Java Programming for OO Experienced Developers – 4 days Related TDD, JUnit & Unit Testing Courses TT3550 Agile Primer | Understanding Agile Development ‐ An Overview (1 day) TT3530 Understanding Agile Test‐Driven Development (TDD) for Non‐Developers (2 days) TT3555 Understanding BDD, TDD, and Unit Testing | A Technical Overview (1 day) TT3500 Mastering Test‐Driven Development with JUnit (5 days) TT3535‐J Implementing Agile Test‐Driven Development for Java Developers (3 days) TT3524 Unit Testing Essentials using JUnit 5 and EasyMock (3 days) TT3526 Unit Testing Essentials using JUnit 5 and Mockito (3 days) TT3540 Agile Continuous Integration, Testing, and Deployment (CI, Refactoring, GIT, BitBucket & More) (5 days) Follow On Courses: Our TDD and programming tracks include a wide variety of follow‐on courses and learning paths for leveraging Java for next‐level development, testing, security and more. Please see our Java Developer Training Suite & Learning Paths or Testing, TDD, Test Automation & Web Testing Tools (Selenium, Gherkin, Cucumber) Suite of courses, or inquire for recommendations based on your specific role and goals. Enhanced Learning Services: Please also ask about our Pre‐Training Class OnRamp & Prep / Primer offerings, Skills Gap Assessment Services, Case Studies, Knowledge Check Quizzes, Skills Immersion Programs & Camps, Collaborative Mentoring Services and Extended Learning Support & Post Training services. Course Topics / Agenda Please note that this list of topics is based on our standard course offering, evolved from typical industry uses and trends. We’ll work with you to tune this course and level of coverage to target the skills you need most. Topics, agenda and labs are subject to change, and may adjust during live delivery based on audience interests and skill‐level. Session: Introduction Lesson: Jumpstart: JUnit 5.x class or method from running . Understand and work with the Lab: Demo JUnit Lesson: Introduction features of JUnit Lab: Build JUnit Case Study . Introduce Test Driven . Write unit tests using @Test Lab: Jumpstart JUnit Development annotation Lab: Reapplying JUnit . Use @DisplayName to specify a Session: Unit Testing using JUnit custom name for the test Lesson: Annotations . Describe the test execution cycle Lesson: Unit Testing Fundamentals Manage fixtures using . Check for exceptions thrown by . Purpose of Unit Testing @BeforeEach, @AfterEach, test . Good Unit Tests @BeforeAll and @AfterAll . Use timeouts to fail test that take . Test Stages annotations . longer than required . Unit Testing Vs Integration Launch tests using @ExtendWith Testing (@RunWith – JUnit 4+) Lab: Working with @Test . Understanding Unit Testing annotation Annotation . Frameworks Build test suites using Lesson: Hamcrest @SelectPackages or . @SelectClasses Learn the notation of assertThat . Use @Disabled to prevent a test . Know the objective of Hamcrest Trivera Technologies ● IT Training, Coaching & Courseware Solutions www.triveratech.com ● [email protected] ● toll free 844.475.4559 Unit Testing Essentials with JUnit 5 and EasyMock ● TT3524 2020 ● Page 2 TDD & Trivera Technologies Unit Testing Collaborative IT Training, Coaching & Courseware Solutions Training Series w w w . t r i v e r a t e c h . c o m ● [email protected] library Lesson: JUnit Best Practices Lab: Working With EasyMock . Use Hamcrest's logical and object . "Good" Tests matchers . Bad Smell Lesson: PowerMock . Use Hamcrest's number and . White‐Box Unit Testing . PowerMock Description and collection matchers . Black‐Box Unit Testing Features Lab: Working with Hamcrest . Automation and Coverage . PowerMock Object Lifecycle . Mocking a Static Method Lesson: Parameterized Tests Session: Advanced Topics . The @ParameterizedTest Lesson: Improving Code Quality annotation Lesson: Mocking of Components Through Refactoring . A parameterized test to test code . Why We use Test Dummies . Refactoring Overview under several conditions . Mock Objects . Refactoring and Testing . Generic tests to support . Working with Mock Objects . Refactoring to Design Patterns parameterized testing . Using Mocks with the User . Naming conventions Lab: Working with Parameterized Interface Lab: Refactoring Tests . Mock Object Strategies Lab: Best Practices ‐ Refactoring Tests Lesson: Advanced Features Lesson: Mock Objects and EasyMock . Nested Unit Tests . EasyMock Description and Session: Appendix . Repeated Tests Features . JUnit Extensions . EasyMock Object Lifecycle Lesson: Adding Testing to the Build . Conditions . Create/Expect Phase Process . Lambda Support . Replay/Verify Phase . JUnit and Ant . Grouped Assertions . Mocking Complex Objects . The Ant JUnit Tag . Lab: Working with Advanced . EasyMock HOWTO Running JUnit Tests From Ant Features Lab: Mock Objects and EasyMock Generating a