Are you looking for a simple guide to learning unit testing? This video course is perfect for you. It includes hands-on exercises and best practices to help you understand JUnit and Mockito unit testing with ease.
JUnit and Mockito Unit Testing for Java Developers
Instructeur : Packt - Course Instructors
Inclus avec
Expérience recommandée
Ce que vous apprendrez
Analyze production code to identify areas for writing quality unit tests.
Implement JUnit's fail-fast mechanism to improve test efficiency.
Understand and apply Mockito for creating and using mock objects in unit tests.
Create readable assertions by composing Hamcrest matchers.
Compétences que vous acquerrez
- Catégorie : Unit Testing
- Catégorie : Hamcrest
- Catégorie : Mockito
- Catégorie : Junit
- Catégorie : API Testing
Détails à connaître
Ajouter à votre profil LinkedIn
septembre 2024
3 devoirs
Découvrez comment les employés des entreprises prestigieuses maîtrisent des compétences recherchées
Obtenez un certificat professionnel
Ajoutez cette qualification à votre profil LinkedIn ou à votre CV
Partagez-le sur les réseaux sociaux et dans votre évaluation de performance
Il y a 6 modules dans ce cours
In this module, we will introduce you to the course and its structure. The welcome video provides an overview of what you can expect from the course, setting the stage for your learning journey. Following this, the course structure overview gives a detailed breakdown of each section, ensuring you know how to navigate through the content effectively.
Inclus
2 vidéos1 lecture
In this module, we will delve into the foundations of unit testing. We'll start with an overview of what unit testing is and the basic concepts behind it. You will then learn about JUnit, a popular tool for unit testing in Java, and see how to write a simple unit test using JUnit. The section continues with detailed explanations of the structure of unit tests, conventions to follow, and the characteristics of proper unit tests. Finally, we will cover the use of assertions in JUnit to validate test results effectively.
Inclus
8 vidéos
In this module, we will guide you through the process of creating a Java project using JUnit. We'll begin by demonstrating how to set up a project using the Maven Quickstart Archetype. Next, you'll learn about the typical structure of a Java project, with a focus on the differences between production and test source trees. Finally, we will cover the essential conventions for creating unit tests, including proper package organization and naming practices, ensuring that your tests are well-organized and easy to maintain.
Inclus
4 vidéos1 devoir
In this module, we will cover the comprehensive process of writing and running unit tests using JUnit and IntelliJ IDEA. You will learn how to create test methods with the @Test annotation, run these tests within an IDE, and understand the success and failure of tests. We will explore handling exceptions in test failures and the explicit use of Assert.Fail() for validation logic. Additionally, you will be introduced to JUnit's assertions API and the fail-fast test failure mechanism. Finally, we'll delve into best practices like adding descriptive comments to assertions, maintaining DRY principles with @Before, and understanding test fixture instantiation.
Inclus
13 vidéos
In this module, we will explore the use of mock objects and Mockito for unit testing. You'll start by understanding the fundamentals of Mockito and how mock objects are used in testing. We will guide you through configuring projects with Mockito and creating projects that utilize both JUnit and Mockito. The section covers coding and testing various layers of a layered architecture, including the presentation, business, and persistence layers, ensuring proper package organization. Additionally, you'll learn about setting up test fixtures for mock object-based tests and writing specific tests for components like the login controller and authentication service. Finally, we will discuss important design decisions to consider when unit testing your applications.
Inclus
13 vidéos
In this module, we will dive into the Hamcrest Assertions Library and its applications in unit testing. You will begin by evolving domain and repository classes and learning how to ignore tests using the @ignore annotation. We'll cover the implementation of finders in the repository and business logic in the service layer, along with configuring Maven for Java 8. The section includes refactoring practices to develop new services and generating test methods in the IDE. You'll explore JUnit Mockito Runner, @Mock, and @InjectMocks annotations, and learn to analyze production code for effective test writing. We will replace JUnit assertions with Hamcrest assertions, tackle Hamcrest test failures, and create complex assertions using the allOf method and property matchers.
Inclus
25 vidéos2 devoirs
Instructeur
Offert par
Recommandé si vous êtes intéressé(e) par Software Development
LearnQuest
Coursera Project Network
Coursera Project Network
Pour quelles raisons les étudiants sur Coursera nous choisissent-ils pour leur carrière ?
Ouvrez de nouvelles portes avec Coursera Plus
Accès illimité à 10,000+ cours de niveau international, projets pratiques et programmes de certification prêts à l'emploi - tous inclus dans votre abonnement.
Faites progresser votre carrière avec un diplôme en ligne
Obtenez un diplôme auprès d’universités de renommée mondiale - 100 % en ligne
Rejoignez plus de 3 400 entreprises mondiales qui ont choisi Coursera pour les affaires
Améliorez les compétences de vos employés pour exceller dans l’économie numérique
Foire Aux Questions
Yes, you can preview the first video and view the syllabus before you enroll. You must purchase the course to access content not included in the preview.
If you decide to enroll in the course before the session start date, you will have access to all of the lecture videos and readings for the course. You’ll be able to submit assignments once the session starts.
Once you enroll and your session begins, you will have access to all videos and other resources, including reading items and the course discussion forum. You’ll be able to view and submit practice assessments, and complete required graded assignments to earn a grade and a Course Certificate.