课程: Complete Guide To Java Testing with JUnit 5 & Mockito
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Conditional test execution based on Java version and OS
课程: Complete Guide To Java Testing with JUnit 5 & Mockito
Conditional test execution based on Java version and OS
- [Instructor] Another feature JUnit offers is conditional test execution, which allows tests to be executed selectively based on specific criteria. This allows developers to tailor their testing strategies to particular scenarios, making the testing process more efficient and targeted. Let's take a look at an example. Here we have a class that retrieves the system's information. We can use JUnit annotations to enable certain tests for certain operating systems and versions of Java. In the first test, we'll only want to enable it on Windows. We can do this with the EnabledOnOs annotation. We'll select OS.WINDOWS. This test is only valid if the operating system is Windows, so with this annotation, it'll automatically be disabled for any non-Windows OS. Then for the second test, we'll only enable it if the machine is running Linux. We'll select OS.LINUX. For the third test, we'll enable it if we're running Java 11. We'll do this with the EnabledOnJre annotation. We'll select…
内容
-
-
-
-
-
-
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 秒
-
-
-
-
-
-