课程: Complete Guide To Java Testing with JUnit 5 & Mockito
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Control test execution with @Order
课程: Complete Guide To Java Testing with JUnit 5 & Mockito
Control test execution with @Order
- [Instructor] When writing tests for a given class, tests might need to run in a specific sequence for certain scenarios. Although tests should ideally be independent of each other, there are times when the order of execution impacts the test results, specifically for integration tests. In JUnit 5, you can control the sequence using the @Order annotation. Let's take a look at an example. Here, we have a test class for UserManagementTests. These tests cover the functionality for managing a user. There's a test for updating a user, creating a user, retrieving a user, and deleting a user. Let's run these tests. Two of the four tests fail. All of these tests share a test user. This means the order of the test matters. We'll need to create the user before we try to retrieve it or update it, and we'll need to make sure that the deletion happens last. Let's use the order annotation to ensure these tests are executed properly. The first step is to add the @TestMethodOrder annotation. We'll…
内容
-
-
-
-
-
-
Introduction to parameterized tests in JUnit2 分钟 4 秒
-
(已锁定)
Parameterized tests with EnumSource in JUnit 53 分钟 21 秒
-
(已锁定)
Parameterized tests with ValueSource in JUnit 52 分钟 20 秒
-
(已锁定)
Parameterized tests with CsvSource in JUnit 53 分钟 26 秒
-
(已锁定)
Conditional test execution based on Java version and OS2 分钟 12 秒
-
(已锁定)
Conditional test execution based on environment variables2 分钟 35 秒
-
(已锁定)
Conditional test execution based on custom conditions1 分钟 40 秒
-
(已锁定)
Control test execution with @Order2 分钟 37 秒
-
(已锁定)
Create test suites in JUnit 53 分钟 12 秒
-
(已锁定)
Create a test coverage report with JaCoCo4 分钟 9 秒
-
(已锁定)
Ensure test coverage with JaCoCo5 分钟 41 秒
-
(已锁定)
Execute parallel tests in JUnit 52 分钟 41 秒
-
(已锁定)
Custom extensions in JUnit 54 分钟 40 秒
-
(已锁定)
Challenge: Write a test class for a email validator1 分钟 57 秒
-
(已锁定)
Solution: Write a test class for a email validator5 分钟 32 秒
-
-
-
-
-
-