Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/david-kariuki/junit5-testing-java

This is a java project to learn JUnit testing. https://david-kariuki.github.io/JUnitTestingProject/
https://github.com/david-kariuki/junit5-testing-java

junit junit-extension junit-jupiter junit-test junit5

Last synced: 2 months ago
JSON representation

This is a java project to learn JUnit testing. https://david-kariuki.github.io/JUnitTestingProject/

Awesome Lists containing this project

README

        

# JUnit5TestingProject


**Hello there**,

This is a java project to learn JUnit testing. Feel free to click on discussions for any comments, feedback, questions etc.


![GitHub issues](https://img.shields.io/github/issues/david-kariuki/JUnit5TestingProject?&labelColor=black&color=eb3b5a&label=Issues&logo=issues&logoColor=black&style=for-the-badge)  
![GitHub Contributions](https://img.shields.io/github/contributors/david-kariuki/JUnit5TestingProject?&labelColor=black&color=8854d0&style=for-the-badge)  
![repo size](https://img.shields.io/github/repo-size/david-kariuki/JUnit5TestingProject?label=Repo%20Size&style=for-the-badge&labelColor=black&color=20bf6b)  
![GitHub forks](https://img.shields.io/github/forks/david-kariuki/JUnit5TestingProject?&labelColor=black&color=0fb9b1&style=for-the-badge)  
![GitHub stars](https://img.shields.io/github/stars/david-kariuki/JUnit5TestingProject?&labelColor=black&color=f7b731&style=for-the-badge)  
![GitHub LastCommit](https://img.shields.io/github/last-commit/david-kariuki/JUnit5TestingProject?logo=github&labelColor=black&color=d1d8e0&style=for-the-badge)  


### 1. ASSERTIONS

| # | **Assertion** |
|-|-|
| 1. | assertNull() |
| 2. | assertNotNull() |
| 3. | assertEquals() |
| 4. | assertNotEquals() |
| 5. | fail() method |
| 6. | assertTrue() |
| 7. | assertFalse() |
| 8. | assertSame() |
| 9. | assertNotSame() |
| 10. | assertArrayEquals() |
| 11. | assertIterableEquals() |
| 12. | assertThrows() |
| 13. | assertTimeout() |
| 14. | assertTimeoutPreemtively() |
|||


### 2. LIFECYCLE CALLBACKS

| # | **JUnit 4 Callback** | **JUnit 5 Callback** |
|-|-|-|
| 1. | @Before | @BeforeEach |
| 2. | @BeforeClass | @BeforeAll |
| 3. | @After | @AfterEach |
| 4. | @BeforeClass | @BeforeAll |
| 5. | @AfterClass | @AfterAll |
| 6. | @RunWith | @ExtendWith |
| 7. | @Test | @Test |
| 8. | @Ignore | @Disabled |
| 9. | @Category | @Tag |
||||


### 3. DISPLAY NAMES

| # | **Annotation** | **Scope** |
|-|-|-|
| 1. | @DisplayName | Test Class |
| 2. | @DisplayName | Test Methods |
|||


### 4. DEPENDENCY INJECTION:
***For Constructors and Methods***


| # | **Class** |
|-|-|
| 1. | TestInfoParameterResolver |
| 2. | TestReporterParameterResovler |
| 3. | RepetitionInfoParameterResolver|
|||


### 5. ASSUMPTIONS

| # | **Assumption** |
|-|-|
| 1. | assumeTrue() |
| 2. | assumeFalse() |
| 3. | assumingThat() |
|||


### 6. OTHER ASSUMPTION LIBRARIES

| # | **Library** |
|-|-|
| 1. | AssertJ |
| 2. | Hamcrest |
| 3. | JSONAsser |


### 7. JUNIT 5 EXTENSIONS

| # | Extension |
|-|-|
| 1. | TestInstancePostProcessor |
| 2. | ExecutionCondition |
| 3. | Life Cycle Callback Extensions | BeforeAllCallback, BeforeEachCallback, BeforeTestExecutionCallback, AfterTestExecutionCallback, AftereachCallback, AfterAllCallback |
| 4. | ParameterResolver |
| 5. | TestExecutionExceptionHandler |
|||


### 8. JUnit 5 EXTENSIONS REGISTRATION

| # | **Registration** | Method |
|-|-|-|
| 1. | Declarative registration | @ExtendWith |
| 2. | Programmatic registration | @RegisterExtension |
| 3. | Automatic Registration | ***java.util.ServiceLoader*** |
|||


### 9. OTHER ANNOTATIONS

| # | **Annottation** | Purpose |
|-|-|-|
| 1. | @Enabled | Enable test method |
| 2. | @Disabled | Disbale test method |
| 3. | @EnabledIf | Enable with condition |
| 4. | @DisabledIf | Disable with condition |
| 4. | @EnabledIfEnvironmentVariable | Enable for environment |
| 5. | @DisabledIfEnvironmentVariable | Disable for Enviroment |
| 6. | @EnabledIfSystemProperty | Enable for system property |
| 7. | @DisabledIfSystemProperty | Disable for system property |
| 8. | @EnabledOnJre | Enable for JRE version |
| 9. | @DisabledOnJre | Disable for JRE version |
| 10. | @EnabledForJreRange | Enable for JRE range |
| 11. | @DisabledForJreRange | Disable for JRE range |
| 12. | @Nested | Nested test classes |
| 13. | @ParameterizedTest - @ValueSource | Provide values array |
| 14. | @ParameterizedTest - @EnumSource | Provide enum source |
| 15. | @ParameterizedTest - @MethodSource | Provide values from method |
| 16. | @ParameterizedTest - @CsvSource | Provide values from CSV |
| 17. | @ParameterizedTest - @CsvFileSource | Provide values from CSV file |
| 18. | @RepeatedTest | Repeated test with count @RepeatedTest(n) |
| 19. | @TestFactory | For dynamic tests |
| 20. | @Tag | For tagged test - Tests Classification |
|||