Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproduce #3798: TestModule.testForkGrouping doesn't work with TestNG #3799

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ object dist0 extends MillPublishJavaModule {
build.contrib.jmh.testDep(),
build.contrib.playlib.testDep(),
build.contrib.playlib.worker("2.8").testDep(),
build.contrib.testng.testDep(),
build.bsp.worker.testDep(),
build.testkit.testDep()
)
Expand Down
44 changes: 44 additions & 0 deletions example/javalib/testing/4-test-grouping/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,53 @@ object foo extends JavaModule {
)
def testForkGrouping = discoveredTestClasses().grouped(1).toSeq
}
object testng extends JavaTests with TestModule.TestNg {
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.testng:testng:7.10.2"
)
def testForkGrouping = discoveredTestClasses().grouped(1).toSeq
}
}

/** See Also: foo/test/src/foo/HelloTests.java */
/** See Also: foo/test/src/foo/WorldTests.java */

/** Usage

> mill foo.test

> find out/foo/test/test.dest
...
out/foo/test/test.dest/foo.HelloTests.log
out/foo/test/test.dest/foo.HelloTests/sandbox
out/foo/test/test.dest/foo.WorldTests.log
out/foo/test/test.dest/foo.WorldTests/sandbox
out/foo/test/test.dest/test-report.xml

> mill show foo.testng.discoveredTestClasses
[
"foo.HelloTests",
"foo.WorldTests"
]

> mill show foo.testng.testForkGrouping
[
[
"foo.HelloTests"
],
[
"foo.WorldTests"
]
]

> mill show foo.testng.test
...
..."fullyQualifiedName": "foo.HelloTests",
...
..."fullyQualifiedName": "foo.WorldTests",
...

*/

//// SNIPPET:END

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package foo;

import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class HelloTests {

@Test
public void hello() throws Exception {
System.out.println("Testing Hello");
String result = new Foo().hello();
assertTrue(result.startsWith("Hello"));
Thread.sleep(1000);
System.out.println("Testing Hello Completed");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package foo;

import static org.testng.Assert.assertTrue;
import org.testng.annotations.Test;

public class WorldTests {
@Test
public void world() throws Exception {
System.out.println("Testing World");
String result = new Foo().hello();
assertTrue(result.endsWith("World"));
Thread.sleep(1000);
System.out.println("Testing World Completed");
}
}
Loading