Compare commits
No commits in common. "8632993fed98bed07115fd7d38f81dd5a8962a58" and "47e23dc23c9955d108b65b8d4c05293ae89d2ab1" have entirely different histories.
8632993fed
...
47e23dc23c
11 changed files with 59 additions and 91 deletions
4
.idea/copyright/Apache_License.xml
generated
4
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="Copyright 2023-Copyright &#36;today.yearamp;#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
<option name="notice" value="Copyright &#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||||
<option name="myName" value="Apache License" />
|
<option name="myName" value="Apache License" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
MAIN="org.testng.TestNG"
|
|
||||||
TMPNEW=/tmp/checkcliargs-new
|
|
||||||
TMPOLD=/tmp/checkcliargs-old
|
|
||||||
|
|
||||||
java -cp "lib/test/*" $MAIN >$TMPNEW
|
|
||||||
java -cp "examples/lib/test/*" $MAIN >$TMPOLD
|
|
||||||
|
|
||||||
diff $TMPOLD $TMPNEW
|
|
||||||
|
|
||||||
rm -rf $TMPNEW $TMPOLD
|
|
|
@ -3,16 +3,18 @@ package com.example;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
class ExamplesTest {
|
class ExampleTest {
|
||||||
private final ExamplesLib example = new ExamplesLib();
|
public static void main(String[] args) {
|
||||||
|
new ExampleTest().verifyHello();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void foo() {
|
void testFail() {
|
||||||
Assert.assertNotEquals(example.getMessage(), "foo");
|
Assert.fail("failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void verifyHello() {
|
void verifyHello() {
|
||||||
Assert.assertEquals(example.getMessage(), "Hello World!");
|
Assert.assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -50,7 +50,7 @@ public class TestNgOperationBuild extends Project {
|
||||||
.include(dependency("org.testng", "testng", version(7, 9, 0)))
|
.include(dependency("org.testng", "testng", version(7, 9, 0)))
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 25, 2)));
|
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
|
||||||
|
|
||||||
javadocOperation()
|
javadocOperation()
|
||||||
.javadocOptions()
|
.javadocOptions()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -561,19 +561,6 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Should TestNG use a global Shared ThreadPool (At suite level) for running data providers.
|
|
||||||
*
|
|
||||||
* @param shareThreadPoolForDataProviders {@code true} or {@code false}
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public TestNgOperation shareThreadPoolForDataProviders(boolean shareThreadPoolForDataProviders) {
|
|
||||||
if (shareThreadPoolForDataProviders) {
|
|
||||||
options.put("-shareThreadPoolForDataProviders", String.valueOf(shareThreadPoolForDataProviders));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directories where your javadoc annotated test sources are. This option is only necessary
|
* The directories where your javadoc annotated test sources are. This option is only necessary
|
||||||
* if you are using javadoc type annotations. (e.g. {@code "src/test"} or
|
* if you are using javadoc type annotations. (e.g. {@code "src/test"} or
|
||||||
|
@ -858,19 +845,6 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Should TestNG use a global Shared ThreadPool (At suite level) for running regular and data driven tests.
|
|
||||||
*
|
|
||||||
* @param useGlobalThreadPool {@code true} or {@code false}
|
|
||||||
* @return this operation instance
|
|
||||||
*/
|
|
||||||
public TestNgOperation useGlobalThreadPool(boolean useGlobalThreadPool) {
|
|
||||||
if (useGlobalThreadPool) {
|
|
||||||
options.put("-useGlobalThreadPool", String.valueOf(useGlobalThreadPool));
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Level of verbosity.
|
* Set the Level of verbosity.
|
||||||
*
|
*
|
||||||
|
@ -947,4 +921,4 @@ public class TestNgOperation extends AbstractProcessOperation<TestNgOperation> {
|
||||||
*/
|
*/
|
||||||
CONTINUE
|
CONTINUE
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -85,7 +85,7 @@ class TestNgOperationTest {
|
||||||
void testExecute() {
|
void testExecute() {
|
||||||
assertThatThrownBy(() ->
|
assertThatThrownBy(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.testClass("rife.bld.extension.TestNgExampleTest")
|
.testClass("rife.bld.extension.TestNgSimpleTest")
|
||||||
.execute())
|
.execute())
|
||||||
.as("with testClass").isInstanceOf(ExitStatusException.class);
|
.as("with testClass").isInstanceOf(ExitStatusException.class);
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ class TestNgOperationTest {
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.testClass("rife.bld.extension.TestNgExampleTest")
|
.testClass("rife.bld.extension.TestNgSimpleTest")
|
||||||
.methods("rife.bld.extension.TestNgExampleTest.verifyHello")
|
.methods("rife.bld.extension.TestNgSimpleTest.verifyHello")
|
||||||
.execute())
|
.execute())
|
||||||
.as("with methods").doesNotThrowAnyException();
|
.as("with methods").doesNotThrowAnyException();
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ class TestNgOperationTest {
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.suites("src/test/resources/testng2.xml")
|
.suites("src/test/resources/testng3.xml")
|
||||||
.log(2)
|
.log(2)
|
||||||
.execute())
|
.execute())
|
||||||
.as("suite 2 - log ").doesNotThrowAnyException();
|
.as("suite 3").doesNotThrowAnyException();
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.suites("src/test/resources/testng2.xml")
|
.suites("src/test/resources/testng3.xml")
|
||||||
.testClasspath("lib/test/*", "build/main", "build/test")
|
.testClasspath("lib/test/*", "build/main", "build/test")
|
||||||
.log(2)
|
.log(2)
|
||||||
.execute())
|
.execute())
|
||||||
|
@ -125,7 +125,7 @@ class TestNgOperationTest {
|
||||||
|
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new TestNgOperation().fromProject(new Project())
|
new TestNgOperation().fromProject(new Project())
|
||||||
.suites("src/test/resources/testng2.xml")
|
.suites("src/test/resources/testng3.xml")
|
||||||
.testClasspath(List.of("lib/test/*", "build/main", "build/test"))
|
.testClasspath(List.of("lib/test/*", "build/main", "build/test"))
|
||||||
.log(2)
|
.log(2)
|
||||||
.execute())
|
.execute())
|
||||||
|
@ -315,15 +315,6 @@ class TestNgOperationTest {
|
||||||
assertThat(op.options.get("-testrunfactory")).isEqualTo(FOO);
|
assertThat(op.options.get("-testrunfactory")).isEqualTo(FOO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testShareThreadPoolForDataProviders() {
|
|
||||||
var op = new TestNgOperation().shareThreadPoolForDataProviders(true);
|
|
||||||
assertThat(op.options.get("-shareThreadPoolForDataProviders")).isEqualTo("true");
|
|
||||||
|
|
||||||
op = new TestNgOperation().shareThreadPoolForDataProviders(false);
|
|
||||||
assertThat(op.options.get("-shareThreadPoolForDataProviders")).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSourceDir() {
|
void testSourceDir() {
|
||||||
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
var op = new TestNgOperation().sourceDir(FOO, BAR);
|
||||||
|
@ -384,15 +375,6 @@ class TestNgOperationTest {
|
||||||
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("true");
|
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void testUseGlobalThreadPool() {
|
|
||||||
var op = new TestNgOperation().useGlobalThreadPool(true);
|
|
||||||
assertThat(op.options.get("-useGlobalThreadPool")).isEqualTo("true");
|
|
||||||
|
|
||||||
op = new TestNgOperation().useGlobalThreadPool(false);
|
|
||||||
assertThat(op.options.get("-useGlobalThreadPool")).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testVerbose() {
|
void testVerbose() {
|
||||||
var op = new TestNgOperation().log(1);
|
var op = new TestNgOperation().log(1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -16,15 +16,22 @@
|
||||||
|
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the TestNgExample class.
|
* Implements the TestNgSimpleTest class.
|
||||||
*
|
*
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("PMD.TestClassWithoutTestCases")
|
class TestNgSimple2Test {
|
||||||
class TestNgExample {
|
public static void main(String[] args) {
|
||||||
public String getMessage() {
|
new TestNgSimple2Test().verifyHello();
|
||||||
return "Hello World!";
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void verifyHello() {
|
||||||
|
Assert.assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-2024 the original author or authors.
|
* Copyright 2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -20,21 +20,23 @@ import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the TestNgExampleTest class.
|
* Implements the TestNgSimpleTest class.
|
||||||
*
|
*
|
||||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
class TestNgExampleTest {
|
class TestNgSimpleTest {
|
||||||
private final TestNgExample example = new TestNgExample();
|
public static void main(String[] args) {
|
||||||
|
new TestNgSimpleTest().verifyHello();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void foo() {
|
void testFail() {
|
||||||
Assert.assertEquals(example.getMessage(), "foo");
|
Assert.fail("failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void verifyHello() {
|
void verifyHello() {
|
||||||
Assert.assertEquals(example.getMessage(), "Hello World!");
|
Assert.assertTrue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
<suite name="test suite 1" verbose="2">
|
<suite name="test suite 1" verbose="2">
|
||||||
<test name="simple test">
|
<test name="simple test">
|
||||||
<classes>
|
<classes>
|
||||||
<class name="rife.bld.extension.TestNgExample"/>
|
<class name="rife.bld.extension.TestNgSimpleTest"/>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
</suite>
|
</suite>
|
|
@ -2,9 +2,9 @@
|
||||||
<suite name="test suite 2" verbose="1">
|
<suite name="test suite 2" verbose="1">
|
||||||
<test name="exclude fail">
|
<test name="exclude fail">
|
||||||
<classes>
|
<classes>
|
||||||
<class name="rife.bld.extension.TestNgExampleTest">
|
<class name="rife.bld.extension.TestNgSimpleTest">
|
||||||
<methods>
|
<methods>
|
||||||
<exclude name="foo"/>
|
<exclude name="testFail"/>
|
||||||
</methods>
|
</methods>
|
||||||
</class>
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
|
|
13
src/test/resources/testng3.xml
Normal file
13
src/test/resources/testng3.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
|
||||||
|
<suite name="test suite 3">
|
||||||
|
<test name="test 2 classes">
|
||||||
|
<classes>
|
||||||
|
<class name="rife.bld.extension.TestNgSimpleTest">
|
||||||
|
<methods>
|
||||||
|
<exclude name="testFail"/>
|
||||||
|
</methods>
|
||||||
|
</class>
|
||||||
|
<class name="rife.bld.extension.TestNgSimple2Test"/>
|
||||||
|
</classes>
|
||||||
|
</test>
|
||||||
|
</suite>
|
Loading…
Add table
Add a link
Reference in a new issue