课程: Complete Guide To Java Testing with JUnit 5 & Mockito
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Conditional test execution based on custom conditions
课程: Complete Guide To Java Testing with JUnit 5 & Mockito
Conditional test execution based on custom conditions
- [Instructor] If you want to run a test conditionally but not based on an environment variable, there is an option to create a more custom condition. With the EnabledIf and DisabledIf annotations, you can pass in a condition and that condition is used to determine whether a given test should be run. Let's take a look at a code example. Here, we have a series of tests verifying functionality on weekends and weekdays. We only want the weekdays test to run on weekdays, and the weekend test to run on weekends. Towards the end of the class, we have a method that determines whether a given day is a weekday. Let's use this in our tests. For the first test, we'll only enable it if the isWeekday method returns true. We can use the EnabledIf annotation and pass in the name of the method, isWeekday. Then for the second test, we'll want to run it if it's not a weekday, so we'll use the DisabledIf annotation, passing in that method name. This will disable the test if isWeekday returns true. Now…
内容
-
-
-
-
-
-
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 秒
-
-
-
-
-
-