-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Description and display name examples
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...-junit5/src/test/java/com/epam/reportportal/example/junit5/annotated/DescriptionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.epam.reportportal.example.junit5.annotated; | ||
|
||
import com.epam.reportportal.annotations.Description; | ||
import org.junit.jupiter.api.DynamicTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestFactory; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.junit.jupiter.api.DynamicTest.dynamicTest; | ||
|
||
@Description("Description from Description annotation on class level") | ||
public class DescriptionTest { | ||
|
||
@Test | ||
@Description("Description from Description annotation on method level overrides Description set at class level") | ||
public void testDescriptionTestMethod() { | ||
System.out.println("Inside testDescriptionTestMethod"); | ||
} | ||
|
||
@Test | ||
public void testDescriptionTestClass() { | ||
System.out.println("Inside testDescriptionTestClass"); | ||
} | ||
|
||
@TestFactory | ||
@Description("Description from Description annotation on dynamic test factory") | ||
public Stream<DynamicTest> testForTestFactory() { | ||
return Stream.of(dynamicTest("My dynamic test", () -> System.out.println("Inside dynamic test"))); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...-junit5/src/test/java/com/epam/reportportal/example/junit5/annotated/DisplayNameTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.epam.reportportal.example.junit5.annotated; | ||
|
||
import com.epam.reportportal.annotations.DisplayName; | ||
import org.junit.jupiter.api.DynamicTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestFactory; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.junit.jupiter.api.DynamicTest.dynamicTest; | ||
|
||
@DisplayName("Display name from DisplayName annotation on class level") | ||
public class DisplayNameTest { | ||
@Test | ||
@DisplayName("Display name from DisplayName annotation on method level") | ||
public void testDisplayName() { | ||
System.out.println("Inside testDisplayName"); | ||
} | ||
|
||
@TestFactory | ||
@DisplayName("Display name from DisplayName annotation on dynamic test factory") | ||
public Stream<DynamicTest> testForTestFactory() { | ||
return Stream.of(dynamicTest("My dynamic test", () -> System.out.println("Inside dynamic test"))); | ||
} | ||
|
||
@Test | ||
@org.junit.jupiter.api.DisplayName("Display name from JUnit's annotation on method level") | ||
@DisplayName("Display name from ReportPortal's annotation overrides JUnit's annotation") | ||
public void testDisplayNameOverride() { | ||
System.out.println("Inside testDisplayNameOverride"); | ||
} | ||
} |