Reputation: 27
I have a Gradle configuration for a test task:
task ClientTest(type : Test,dependsOn:'CopyAllToOneFolder'){
copy {
from 'build\\classes\\java\\main'
into 'build\\classes\\java\\test'
}
useTestNG() {
systemProperty 'headless', '1'
suites '/src/test/resources/run/ClienPageTest.xml'
}
}
I have an XML for TestNG suite:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Client test" >
<parameter name="browsername" value="chrome"/>
<parameter name="headless" value="true"/>
<listeners>
<listener class-name="Listeners.ReporterListener"/>
<listener class-name="Listeners.TestResultListener"/>
<listener class-name="Listeners.TestSuiteListener"/>
</listeners>
<test name="RegistrationTest">
<classes>
<class name="org.client.RegistrationTest"></class>
</classes>
</test>
</suite>
When I am launching these test from Inlelijj IDEA as TestNG with XML test are executed correctly. But when I am launching tests from Gradle it simply ignores them.
What is wrong here?
Upvotes: 1
Views: 1042
Reputation: 27
Ok.. this was just a type problem. I missed ClienPage instead of ClientPage... Anyway... Problem occured but was handled by following
Upvotes: 0
Reputation: 33441
First of all: what are that copy
s in your test task? Why do you need them? Can you remove them totally or at least move them to a separate task. Test
tasks should only do tests!
I bet the problem is in your suites path in TestNG configuration:
suites '/src/test/resources/run/ClienPageTest.xml'
This is an absolute path to the /src/
folder in the root of the FS. What you might want instead is:
suites '${projectDir}/src/test/resources/run/ClienPageTest.xml'
Upvotes: 1