Added log/verbose command line options and related tests
This commit is contained in:
parent
1bb359dcc6
commit
a84a6fe9e2
4 changed files with 122 additions and 27 deletions
|
@ -96,6 +96,13 @@ class TestNgOperationTest {
|
|||
.suites("src/test/resources/testng2.xml")
|
||||
.execute())
|
||||
.doesNotThrowAnyException();
|
||||
|
||||
assertThatCode(() ->
|
||||
new TestNgOperation().fromProject(new Project())
|
||||
.suites("src/test/resources/testng3.xml")
|
||||
.log(2)
|
||||
.execute())
|
||||
.doesNotThrowAnyException();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -302,6 +309,15 @@ class TestNgOperationTest {
|
|||
assertThat(op.options.get("-usedefaultlisteners")).isEqualTo("true");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testVerbose() {
|
||||
var op = new TestNgOperation().log(1);
|
||||
assertThat(op.options.get("-log")).isEqualTo("1");
|
||||
|
||||
op = new TestNgOperation().verbose(1);
|
||||
assertThat(op.options.get("-verbose")).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testXmlPathInJar() {
|
||||
var op = new TestNgOperation().xmlPathInJar(FOO);
|
||||
|
|
37
src/test/java/rife/bld/extension/TestNgSimple2Test.java
Normal file
37
src/test/java/rife/bld/extension/TestNgSimple2Test.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright 2023 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.
|
||||
*/
|
||||
|
||||
package rife.bld.extension;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Implements the TestNgSimpleTest class.
|
||||
*
|
||||
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
|
||||
* @since 1.0
|
||||
*/
|
||||
class TestNgSimple2Test {
|
||||
public static void main(String[] args) {
|
||||
new TestNgSimple2Test().verifyHello();
|
||||
}
|
||||
|
||||
@Test
|
||||
void verifyHello() {
|
||||
Assert.assertTrue(true);
|
||||
}
|
||||
}
|
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