课程: Complete Guide To Java Testing with JUnit 5 & Mockito
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Parameterized tests with EnumSource in JUnit 5
课程: Complete Guide To Java Testing with JUnit 5 & Mockito
Parameterized tests with EnumSource in JUnit 5
- [Instructor] Let's practice using parameterized tests in JUnit 5. Here, we have a sample enum class that has some repetitive logic. It runs several tests that assert whether or not a given role has write permissions. Let's simplify this using parameterization. Instead of having four tests, one for each user role, we'll have two. One that verifies those with write permission, and the other that verifies those without write permission. These will take in a user role. For those with write permission, we'll assert that they do have write permission with the assertTrue. And for those without, we'll assert that this returns false to ensure they do not have write permission. Each of these will be a parameterized test, so we'll use the ParameterizedTest annotation. Now, in order to use this annotation, we'll need to update our POM file with the JUnit Jupiter params artifact. We'll go to our dependencies and add a new dependency. The groupId will be the same as our JUnit Jupiter API module…
内容
-
-
-
-
-
-
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 秒
-
-
-
-
-
-