Mastering Test-Driven Development Using Junit Course Description

Total Page:16

File Type:pdf, Size:1020Kb

Mastering Test-Driven Development Using Junit Course Description Contact Us [email protected] HOME > COURSE CATALOG > ORACLE > JAVA > MASTERING TEST-DRIVEN DEVELOPMENT USING JUNIT Mastering Test-Driven Development using JUnit DURATION 5 Days COURSE EJCJ-520-CZ AVAILABLE FORMATS Classroom Training, Online Training Course Description Overview This Mastering Test-Driven Development using JUnit course is designed to provide students with a five-day, comprehensive hands-on test-driven development / JUnit / TDD training course geared for developers who need to get up and running with essential Test-driven development programming skills, using JUnit and various open-source testing frameworks. Throughout the course students learn the best practices for writing great programs in Java, using test-driven development techniques. This comprehensive course also covers essential TDD topics and skills. Students who attend Mastering Test-Driven Development using JUnit will leave the course armed with the skills they require to develop solid Java programs, using sound coding testing techniques and best coding practices. This course quickly introduces developers to the features of JUnit and educates them regarding JUnit’s strengths and weaknesses. 9/26/2021 1 of 6 9:22:18 PM The following JUnit-based testing frameworks are examined: JUnit 4.x EasyMock PowerMock jWebUnit DBUnit This course is one step in the following Learning Journey: 1. Java - Core Objectives Upon completion of the Mastering Test-Driven Development using JUnit course, students will be able to: Test basic Java functionality Test web-functionality implemented in JEE Use mocks for needed resources Replace mocks and test database operations Integrate the layers of the application using Spring and testing as they progress 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. Use best practices and patterns for test development. 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. Compile and execute programs using JUnit, jWebUnit, and DBUnit using the IDE of your choice. How to extend testing with mock objects using EasyMock. Look at refactoring techniques available to make code as reusable/robust as possible. 9/26/2021 2 of 6 9:22:18 PM Discuss various testing techniques. Audience 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. Prerequisites OO Java Development experience JEE for Web Application Development experience Topics SESSION: INTRODUCTING TEST-DRIVEN DEVELOPMENT (TDD) TEST, code, refactor, repeat THE ROI of TDD RATIONALE ADVANTAGES TOOLS 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 9/26/2021 3 of 6 9:22:18 PM 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 JWebUnit JWebUnit/HttpUnit LESSON: MOCKING OF COMPOMENTS WHY we use test dummies MOCK objects WORKING with mock objects USING mocks with the user interface MOCK object strategies LESSON: POWERMOCK EASYMOCK description and features EASYMOCK object lifecycle CREATE/expect phase REPLAY/verify phase MOCKING complex objects EASYMOCK howto LESSON: STATE-BASED VS. INTERACTION-BASED TESTING 9/26/2021 4 of 6 9:22:18 PM STATE-based vs. INTERACTION-based testing STATE-based testing INTERACTION-based testing PROS and cons of each LESSON: IMPROVING CODE QUALITY THROUGH REFACTORING REFACTORING overview REFACTORING and testing REFACTORING to design patterns NAME conventions LESSON: DATABASE TESTING DATABASE testing: dbunit ISSUES related to database testing PERSISTENCE mechanisms DBUNIT APPENDIX: ADDING TESTING TO THE BUILD PROCESS JUNIT and Ant THE Ant Junit tag RUNNING Junit tests from Ant GENERATING a JUnitReport Related Courses Unit Testing Essentials using JUnit5 and Mockito TT3526-CZ 3 Days Classroom Training, Online Training Price: 38,780.00 CZK Behavior and Test Driven Development using Junit EJCJ-540-CZ 9/26/2021 5 of 6 9:22:18 PM 3 Days Classroom Training Price: 38,780.00 CZK 9/26/2021 6 of 6 9:22:18 PM.
Recommended publications
  • Practical Methods for Programmer Testing
    JUnit Recipes Practical Methods for Programmer Testing J.B.Rainsberger with contributions by Scott Stirling MANNING JUnit Recipes Practical Programmer Testing Methods by J.B. Rainsberger Chapter 1 Copyright 2004 Manning Publications Rainsberger.book Page 3 Monday, June 28, 2004 6:42 PM Fundamentals This chapter covers ■ An introduction to Programmer Testing ■ Getting started with JUnit ■ A few good practices for JUnit ■ Why testing replaces debugging 3 Rainsberger.book Page 4 Monday, June 28, 2004 6:42 PM 4 CHAPTER 1 Fundamentals We hate debugging. You look up at the clock to see how late it is because you still have a handful of defects that need to be fixed tonight. Welcome to the “fix” phase of “code and fix,” which is now entering its third month. In that time, you have begun to forget what your home looks like. The four walls of your office—assuming you even have four walls to look at—are more familiar than you ever wanted them to be. You look at the “hot defects” list and see one problem that keeps coming back. You thought you fixed that last week! These testers...when will they leave you alone?! Fire up the debugger, start the application server—grab a coffee because you have five minutes to kill—set a breakpoint or two, enter data in 10 text fields and then press the Go button. As the debugger halts at your first breakpoint, your goal is to figure out which object insists on sending you bad data. As you step through the code, an involuntary muscle spasm—no doubt from lack of sleep—causes you to accidentally step over the line of code that you think causes the problem.
    [Show full text]
  • Bringing Test-Driven Development to Web Service Choreographies
    Journal of Systems and Software • October 2014 • http://www.sciencedirect.com/science/article/pii/S016412121400209X Bringing Test-Driven Development to Web Service Choreographies Felipe Besson,Paulo Moura,Fabio Kon Dejan Milojicic Department of Computer Science Hewlett Packard Laboratories University of São Paulo Palo Alto, USA {besson, pbmoura, kon}@ime.usp.br [email protected] Abstract Choreographies are a distributed approach for composing web services. Compared to orchestrations, which use a centralized scheme for distributed service management, the interaction among the chore- ographed services is collaborative with decentralized coordination. Despite the advantages, choreography development, including the testing activities, has not yet evolved sufficiently to support the complexity of the large distributed systems. This substantially impacts the robustness of the products and overall adoption of choreographies. The goal of the research described in this paper is to support the Test-Driven Development (TDD) of choreographies to facilitate the construction of reliable, decentralized distributed systems. To achieve that, we present Rehearsal, a framework supporting the automated testing of chore- ographies at development-time. In addition, we present a choreography development methodology that guides the developer on applying TDD using Rehearsal. To assess the framework and the methodology, we conducted an exploratory study with developers, whose result was that Rehearsal was considered very helpful for the application of TDD and that the methodology helped the development of robust choreographies. Keywords: Automated testing, Test-Driven Development, Web service choreographies I. Introduction Service-Oriented Architecture (SOA) is a set of principles and methods that uses services as the building blocks for the development of distributed applications.
    [Show full text]
  • Unit Testing Essentials Using Junit 5 and Mockito
    Trivera Technologies IT Training Coaching Courseware Collaborate. Educate. Accelerate! Unit Testing Essentials using JUnit 5 and Mockito (with Best Practices) Explore Unit Testing, JUnit, Best Practices, Testing Apps with Native IDE Support, Debugging, Using Mockito & 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 Mockito (TT3526) 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 Mockito. This course is also available for JUnit 4, or JUnit 5 and EasyMock. 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 Mockito 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, Mockito, and other tools.
    [Show full text]
  • BONUS CHAPTER Contents
    BONUS CHAPTER contents preface xvii acknowledgments xix about this book xxi about the cover illustration xxvii PART 1 A TDD PRIMER ..............................................1 The big picture 3 1 1.1 The challenge: solving the right problem right 5 Creating poorly written code 5 ■ Failing to meet actual needs 6 1.2 Solution: being test-driven 7 High quality with TDD 8 ■ Meeting needs with acceptance TDD 10 ■ What’s in it for me? 11 1.3 Build it right: TDD 14 Test-code-refactor: the heartbeat 15 ■ Developing in small increments 19 ■ Keeping code healthy with refactoring 24 ■ Making sure the software still works 28 i ii CONTENTS 1.4 Build the right thing: acceptance TDD 31 What’s in a name? 31 ■ Close collaboration 32 ■ Tests as a shared language 33 1.5 Tools for test-driven development 36 Unit-testing with xUnit 36 ■ Test frameworks for acceptance TDD 37 ■ Continuous integration and builds 37 ■ Code coverage 39 1.6 Summary 41 Beginning TDD 43 2 2.1 From requirements to tests 45 Decomposing requirements 45 ■ What are good tests made of? 47 ■ Working from a test list 47 ■ Programming by intention 48 2.2 Choosing the first test 48 Creating a list of tests 49 ■ Writing the first failing test 50 ■ Making the first test pass 54 ■ Writing another test 56 2.3 Breadth-first, depth-first 58 Faking details a little longer 59 ■ Squeezing out the fake stuff 60 2.4 Let’s not forget to refactor 63 Potential refactorings in test code 64 ■ Removing a redundant test 65 2.5 Adding a bit of error handling 66 Expecting an exception 66 ■ Refactoring toward
    [Show full text]
  • Mastering Test-Driven Development (TDD) Using Junit
    Trivera Technologies Explore. Learn. Advance! Collaborative IT Training, Coaching & Skills Development Solutions Mastering Test-Driven Development (TDD) using JUnit Explore JUnit, Testing Apps with Native IDE Support, Use Mock Objects, TDD Best Practices, Refactoring & Much More w w w . t r i v e r a t e c h . c o m Course Snapshot Course: Mastering Test-Driven Development (TDD) using JUnit (TT3500) Duration : 5 days Audience & Skill-Level : This in an introduction to TDD course for experienced Java developers Hands-on Learning: This lab-intensive, hands-on course combines engaging expert lessons, demos and group discussions with real-world, skills-focused machine-based 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 blended learning format . Please also ask about our Self-Paced / Video / QuickSkills or Mini-Camp / Short Course flexible delivery 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 ask for details. Overview Mastering Test Driven Development using JUnit is a five-day, comprehensive hands-on test-driven development / JUnit / TDD training course geared for developers who need to get up and running with essential Test-driven development programming skills using JUnit and various open-source testing frameworks. Throughout the course you'll learn, explore and gain practcal experience working with best practices for writing great programs in Java, using test-driven development techniques.
    [Show full text]
  • Unit Testing Essentials Using Junit 5 and Easymock (With
    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.
    [Show full text]
  • Software Testing Trying Hard to Make Software Fail
    Software Testing Trying Hard to Make Software Fail Ludovic Court`es Service d'exp´erimentation& d´eveloppement 7 June 2011 1 Introduction 2 Practicalities Running Tests What to Test? When Write Tests? 3 Beyond to find & isolate bugs to make sure bugs get fixed to make sure bugs don't come back Want your software to be studied for its bugs? Why Test? \Faults in Linux: Ten Years Later", Palix et. al, 2010 http://faultlinux.lip6.fr/ to find & isolate bugs to make sure bugs get fixed to make sure bugs don't come back Why Test? Want your software to be studied for its bugs? \Faults in Linux: Ten Years Later", Palix et. al, 2010 http://faultlinux.lip6.fr/ to make sure bugs get fixed to make sure bugs don't come back Want your software to be studied for its bugs? \Faults in Linux: Ten Years Later", Palix et. al, 2010 http://faultlinux.lip6.fr/ Why Test? to find & isolate bugs to make sure bugs don't come back Want your software to be studied for its bugs? \Faults in Linux: Ten Years Later", Palix et. al, 2010 http://faultlinux.lip6.fr/ Why Test? to find & isolate bugs to make sure bugs get fixed Want your software to be studied for its bugs? \Faults in Linux: Ten Years Later", Palix et. al, 2010 http://faultlinux.lip6.fr/ Why Test? to find & isolate bugs to make sure bugs get fixed to make sure bugs don't come back 1 Introduction 2 Practicalities Running Tests What to Test? When Write Tests? 3 Beyond \Determining success or failure of tests must be an automatic process." | B.
    [Show full text]
  • Java Test Driven Development with Junit 5 Course Summary
    "Charting the Course ... ... to Your Success!" Java Test Driven Development with JUnit 5 Course Summary Description Test Driven Development (TDD) has become a standard best practice for developers, especially those working in an Agile development environment. TDD is a team and individual code development discipline which, when followed correctly, increases the productivity of both individual developers and entire teams. From the programmer’s perspective, TDD has another benefit – it allows programmers to eliminate the tedious tasks of debugging and rewriting code so that they can focus on the creative work of designing and writing code. It makes programming fun again. The course focuses on two main topic streams. The first is how to start using the TDD process and inte-grate it into code development or maintenance activities. The best practices for TDD are covered in depth including explanations on why these are best practices. This stream concludes with an introduction into the practice of how TDD is used to refactor and improve existing code as well as code under development. The second stream is tool oriented. Students learn the features of the new JUnit 5 tool through a hands on exploration of the framework, as well as exploring some of the common assertion and mocking libraries. The class is designed to be about 50% hands on labs and exercises, about 25% theory and 25% instructor led hands on learning where students code along with the instructor. The course closes with students developing an action plan for implementing what they
    [Show full text]
  • The Junit Unit Testing Framework
    The JUnit Unit Testing Framework Péter Jeszenszky 2021.05.09. Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09. 1 / 25 SUnit SUnit is a unit testing framework for the SmallTalk programming language that is considered to be the mother of all unit testing frameworks. It was written by Kent Beck in 1994. Website: http://sunit.sourceforge.net/ See: Martin Fowler. xUnit. 17 January 2006. https://martinfowler.com/bliki/Xunit.html Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09. 2 / 25 xUnit (1) xUnit is a family of unit testing frameworks that follow the architecture of the SUnit unit testing framework for the SmallTalk programming language. JUnit was the first member of the xUnit family that became widely used and popular. Over the years JUnit have been ported to many other programming languages. Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09. 3 / 25 xUnit (3) Other notable members of the xUnit family: C++: CppUnit (license: GNU LGPLv2.1) https://www.freedesktop.org/wiki/Software/cppunit/ .NET: NUnit (license: MIT License) https://nunit.org/ https://github.com/nunit/nunit Python: unittest (license: Python Software Foundation License) https://docs.python.org/3/library/unittest.html Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09. 4 / 25 JUnit History JUnit was written by Kent Beck and Erich Gamma in 1997. The current major version is 5. Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09. 5 / 25 JUnit Availability License: Eclipse Public License 2.0 Website: https://junit.org/junit5/ Repository: https://github.com/junit-team/junit5 Maven Central: JUnit artifacts are available in Maven Central The list of JUnit artifacts: https://junit.org/junit5/docs/current/user- guide/#dependency-metadata Documentation: JUnit 5 User Guide https://junit.org/junit5/docs/current/user-guide/ Javadoc: https://junit.org/junit5/docs/current/api/ Péter Jeszenszky The JUnit Unit Testing Framework 2021.05.09.
    [Show full text]
  • Mockito Programming Cookbook I
    Mockito Programming Cookbook i Mockito Programming Cookbook Mockito Programming Cookbook ii Contents 1 Mockito Tutorial for Beginners 1 1.1 What is mocking?...................................................1 1.1.1 Why should we mock?............................................1 1.2 Project creation....................................................2 1.3 Mockito installation..................................................4 1.3.1 Download the JAR..............................................4 1.3.2 With build tools................................................5 1.3.2.1 Maven...............................................5 1.3.2.2 Gradle...............................................5 1.4 Base code to test...................................................6 1.5 Adding behavior...................................................7 1.6 Verifying behavior..................................................8 1.6.1 Verify that method has been called......................................8 1.6.2 Verify that method has been called n times.................................8 1.6.3 Verify method call order...........................................9 1.6.4 Verification with timeout........................................... 10 1.7 Throwing exceptions................................................. 10 1.8 Shorthand mock creation............................................... 11 1.9 Mocking void returning methods........................................... 12 1.10 Mocking real objects: @Spy............................................. 14 1.11 Summary......................................................
    [Show full text]
  • Regression Testing of Transcompiled Cross-Platform Applications
    Regression Testing of Transcompiled Cross-Platform Applications Dissertation der Mathematisch- und Naturwissenschaftlichen Fakult¨at der Eberhard Karls Universit¨atT¨ubingen zur Erlangung des Grades eines Doktors der Naturwissenschaften (Dr. rer. nat.) vorgelegt von Dipl.-Inform. Matthias Hirzel aus M¨unsingen T¨ubingen 2018 Gedruckt mit Genehmigung der Mathematisch-Naturwissenschaftlichen Fakult¨at der Eberhard Karls Universit¨atT¨ubingen. Tag der m¨undlichen Qualifikation: 20.09.2018 Dekan: Prof. Dr. Wolfgang Rosenstiel 1. Berichterstatter: Prof. Dr. Herbert Klaeren 2. Berichterstatter: Prof. Dr. Torsten Grust Abstract Regression testing is a well-accepted and widely used way to ensure that already existing functionality still works as expected when code has been modified in order to realize new features or to resolve known bugs. To this end, devel- opers re-execute previously created tests and check whether these tests still pass. However, depending on the application, regression testing might be very time consuming. This already applies when testing small units, but plays a more and more decisive role when integrated functions and especially end-to- end tests (such as UI or web tests) have to be re-executed. In the worst case, executing all the tests takes several days or even weeks. Consequently, it takes far too much time to get feedback about test failures. In order to solve this problem, researches have presented many different techniques. Originally, these techniques have been tailor-made for standard desktop applications. With the dawn of web applications, it has turned out that the approaches available so far are not directly applicable to web applications. So more and more researches have attended to the special challenges to realize regression testing techniques for this new kind of application.
    [Show full text]
  • A Large Scale Evaluation of Automated Unit Test Generation Using Evosuite
    A A Large Scale Evaluation of Automated Unit Test Generation Using EvoSuite Gordon Fraser, Department of Computer Science, University of Sheffield, Regent Court, 211 Portobello S1 4DP, Sheffield, UK Gordon.Fraser@sheffield.ac.uk Andrea Arcuri, Certus Software V&V Center at Simula Research Laboratory, P.O. Box 134, Lysaker, Norway [email protected] Research on software testing produces many innovative automated techniques, but because software testing is by necessity incomplete and approximate, any new technique faces the challenge of an empirical assessment. In the past, we have demonstrated scientific advance in automated unit test generation with the EVOSUITE tool by evaluating it on manually selected open source projects or examples that represent a particular problem addressed by the underlying technique. However, demonstrating scientific advance is not necessarily the same as demonstrating practical value: Even if EVOSUITE worked well on the software projects we selected for evaluation, it might not scale up to the complexity of real systems. Ideally, one would use large “real-world” software systems to minimize the threats to external validity when evaluating research tools. However, neither choosing such software systems nor applying research prototypes to them are trivial tasks. In this paper we present the results of a large experiment in unit test generation using the EVOSUITE tool on 100 randomly chosen open source projects, the 10 most popular open source projects according to the SourceForge website, 7 industrial projects, and 11 automatically generated software projects. The study confirms that EVOSUITE can achieve good levels of branch coverage (on average 71% per class) in practice. However, the study also exemplifies how the choice of software systems for an empirical study can influence the results of the experiments, which can serve to inform researchers to make more conscious choices in the selection of software system subjects.
    [Show full text]