课程: Complete Guide To Java Testing with JUnit 5 & Mockito
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Parameterized tests with ValueSource in JUnit 5
课程: Complete Guide To Java Testing with JUnit 5 & Mockito
Parameterized tests with ValueSource in JUnit 5
- [Instructor] Let's refactor a non-enum test class to use parameterized tests. Here, we have a class with several tests that verify the functionality of an isPalindrome method. We can simplify this using the parameterized test and value source annotations. We'll separate those that are palindromes and those that are not palindromes into separate tests. Then we'll use the ValueSource annotation to test specific cases. For is palindrome, we'll pass in the empty string, a racecar, RaceCar with capitalization, and then those that are not palindromes would be hello, world, java, and JUnit. Let's delete these other tests and run it. And the tests pass. In our test results, we can see each test run, and run a specific case again, if we want to. For example, we could run just a again with the play button, and only that case will be run. With parametrized tests, we can consolidate similar test cases into single parametrized test methods.
内容
-
-
-
-
-
-
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 秒
-
-
-
-
-
-