Packt
JUnit and Mockito Unit Testing for Java Developers

Ce cours n'est pas disponible en Français (France)

Nous sommes actuellement en train de le traduire dans plus de langues.
Packt

JUnit and Mockito Unit Testing for Java Developers

Inclus avec Coursera Plus

Obtenez un aperçu d'un sujet et apprenez les principes fondamentaux.
niveau Intermédiaire

Expérience recommandée

4 heures pour terminer
3 semaines à 1 heure par semaine
Planning flexible
Apprenez à votre propre rythme
Obtenez un aperçu d'un sujet et apprenez les principes fondamentaux.
niveau Intermédiaire

Expérience recommandée

4 heures pour terminer
3 semaines à 1 heure par semaine
Planning flexible
Apprenez à votre propre rythme

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

Certificat partageable

Ajouter à votre profil LinkedIn

Récemment mis à jour !

septembre 2024

Évaluations

3 devoirs

Enseigné en Anglais

Découvrez comment les employés des entreprises prestigieuses maîtrisent des compétences recherchées

Emplacement réservé
Emplacement réservé

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

Emplacement réservé

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

Packt - Course Instructors
Packt
353 Cours6 667 apprenants

Offert par

Packt

Recommandé si vous êtes intéressé(e) par Software Development

Pour quelles raisons les étudiants sur Coursera nous choisissent-ils pour leur carrière ?

Felipe M.
Étudiant(e) depuis 2018
’Pouvoir suivre des cours à mon rythme à été une expérience extraordinaire. Je peux apprendre chaque fois que mon emploi du temps me le permet et en fonction de mon humeur.’
Jennifer J.
Étudiant(e) depuis 2020
’J'ai directement appliqué les concepts et les compétences que j'ai appris de mes cours à un nouveau projet passionnant au travail.’
Larry W.
Étudiant(e) depuis 2021
’Lorsque j'ai besoin de cours sur des sujets que mon université ne propose pas, Coursera est l'un des meilleurs endroits où se rendre.’
Chaitanya A.
’Apprendre, ce n'est pas seulement s'améliorer dans son travail : c'est bien plus que cela. Coursera me permet d'apprendre sans limites.’
Emplacement réservé

Ouvrez de nouvelles portes avec Coursera Plus

Accès illimité à plus de 7 000 cours de renommée internationale, à des projets pratiques et à des programmes de certificats reconnus sur le marché du travail, 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