Skip to content

Commit

Permalink
Suggestions and try to make the build green
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Feb 27, 2023
1 parent ab336f2 commit 0dadcce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
37 changes: 18 additions & 19 deletions testng-junit-migrator/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# TestNG to JUnit migrator
# TestNG to JUnit Jupiter migrator

An automated TestNG to JUnit 5 migration tool built on top of EPS
A tool to automatically migrate TestNG tests to JUnit Jupiter.

### Example

Consider the following TestNG test:
Consider the following TestNG test class:

```java
// TestNG code:
Expand All @@ -30,32 +30,32 @@ public class A {
This migration tool will turn this into the following:

```java
// JUnit 5 code:
// JUnit Jupiter code:
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class A {
@Test
void simpleTest() {}
@Test
void simpleTest() {}

@Test
@Order(2)
public void priorityTest() {}
@Test
@Order(2)
public void priorityTest() {}

private static Stream<Argument> dataProviderTestCases() {
return Stream.of(arguments(1), arguments(2), arguments(3));
}
private static Stream<Argument> dataProviderTestCases() {
return Stream.of(arguments(1), arguments(2), arguments(3));
}

@ParameterizedTest
@MethodSource("dataProviderTestCases")
public void dataProviderTest(int number) {}
@ParameterizedTest
@MethodSource("dataProviderTestCases")
public void dataProviderTest(int number) {}
}
```

### Installation

First edit your `pom.xml` and add `testng-junit-migrator` to the `annotationPath` of the `maven-compiler` plugin:
First edit your `pom.xml` and add `testng-junit-migrator` to the
`annotationProcessorPaths` of the `maven-compiler` plugin:

```xml

<profiles>
<profile>
<id>testng-migator</id>
Expand Down Expand Up @@ -92,11 +92,10 @@ mvn \
-Ppatch \
clean test-compile fmt:format \
-Derror-prone.patch-checks="TestNGJUnitMigration" \
-Dfrontend.skip \
-Dverification.skip
```

There's script to make invocating this command easier: `run-testng-junit-migrator.sh`.
There's script to make invoking this command easier: `run-testng-junit-migrator.sh`.
This script will:

1. Run your TestNG tests and count the number of completed tests
Expand Down
2 changes: 1 addition & 1 deletion testng-junit-migrator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>error-prone-contrib</artifactId>
<version>0.8.1-SNAPSHOT</version>
<version>${version}</version>
</dependency>
<dependency>
<groupId>com.google.auto</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import java.util.Optional;

/** The annotation argument kinds that are supported by the TestNG -> JUnit migration. */
/** The annotation argument kinds that are supported by the TestNG to JUnit Jupiter migration. */
enum SupportedArgumentKind {
PRIORITY("priority", new PriorityArgumentMigrator()),
DESCRIPTION("description", new DescriptionArgumentMigrator()),
Expand Down

0 comments on commit 0dadcce

Please sign in to comment.