프로젝트에서 Gradle과 TestNG를 사용하기 시작 했으므로 테스트에 실패해도 실제로 빌드가 실패하는지 확인하고 있습니다. 나는 그렇지 않다는 것을 알기에 꽤 놀랐다. 테스트가 선택되어 올바르게 컴파일되므로 클래스 파일이 표시됩니다. 또한 나는 뛰기의보고를 얻는다, 그러나 0의 시험을 말한다 (예상 된 2). gradle clean test -i
을 실행하면 나에게주는 다음Gradle은 컴파일하지만 TestNG 테스트를 실행하지 않습니다.
:contentplatform-service:compileTestJava (Thread[Daemon worker Thread 7,5,main])
started.
:contentplatform-service:compileTestJava
Executing task ':contentplatform-service:compileTestJava' (up-to-date check took
0.08 secs) due to:
Output file D:\Dev\contentplatform-service\build\classes\test has changed.
Output file D:\Dev\contentplatform-service\build\dependency-cache has changed.
Output file D:\Dev\contentplatform-service\build\classes\test\nl\xillio\conten
tplatform\service\SuperSimpleTest.class has been removed.
All input files are considered out-of-date for incremental task ':contentplatfor
m-service:compileTestJava'.
Compiling with JDK Java compiler API.
:contentplatform-service:compileTestJava (Thread[Daemon worker Thread 7,5,main])
completed. Took 0.229 secs.
:contentplatform-service:processTestResources (Thread[Daemon worker Thread 7,5,m
ain]) started.
:contentplatform-service:processTestResources
Skipping task ':contentplatform-service:processTestResources' as it has no sourc
e files.
:contentplatform-service:processTestResources UP-TO-DATE
:contentplatform-service:processTestResources (Thread[Daemon worker Thread 7,5,m
ain]) completed. Took 0.001 secs.
:contentplatform-service:testClasses (Thread[Daemon worker Thread 7,5,main]) sta
rted.
:contentplatform-service:testClasses
Skipping task ':contentplatform-service:testClasses' as it has no actions.
:contentplatform-service:testClasses (Thread[Daemon worker Thread 7,5,main]) com
pleted. Took 0.001 secs.
:contentplatform-service:test (Thread[Daemon worker Thread 7,5,main]) started.
:contentplatform-service:test
Executing task ':contentplatform-service:test' (up-to-date check took 0.049 secs
) due to:
Output file D:\Dev\contentplatform-service\build\test-results\binary\test has
changed.
Output file D:\Dev\contentplatform-service\build\test-results has changed.
Output file D:\Dev\contentplatform-service\build\reports\tests has changed.
Finished generating test XML results (0.0 secs) into: D:\Dev\contentplatform-ser
vice\build\test-results
Generating HTML test report...
Finished generating test html results (0.014 secs) into: D:\Dev\contentplatform-
service\build\reports\tests
:contentplatform-service:test (Thread[Daemon worker Thread 7,5,main]) completed.
Took 0.194 secs.
SuperSimpleTest.java :
package nl.xillio.contentplatform.service;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@Test
public class SuperSimpleTest {
@BeforeClass
public void setUp() {
// code that will be invoked when this test is instantiated
}
@Test
public void testTest() {
Assert.assertEquals(true, true);
}
}
build.gradle가 포함
test {
// enable TestNG support (default is JUnit)
useTestNG()
scanForTestClasses = false
include '**/*'
testLogging {
showStandardStreams = true
// log results to "build/test-results" directory
exceptionFormat "full"
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
}
}
나는 이미이 주제에 대해 other questions을 확인해 보니 대안으로 scanForTestClasses = false
을 사용하는 힌트를 발견했습니다 (https://issues.gradle.org/browse/GRADLE-1682 참조). 그러나이 문제는 관련이없는 것처럼 보입니다. 다른 멍청한 실수를하고 있습니까? SuperSimpleTest를 실행하려면 어떻게해야합니까?
UPDATE :
공유 샘플 프로젝트를 GH에하시기 바랍니다. 도움이 될 것입니다. – Opal
죄송합니다.이 코드를 사용하면 좋겠지 만 그렇게 할 수는 없습니다. 나는 정말로 내가 바보처럼 단순한 것을 잊거나 간과하지 않고있는 이중 점검을 찾고있다. – titusn
나는 최근에 유사한 문제를 해결했습니다 : http://stackoverflow.com/questions/28008918/gradle-not-running-testng-tests-even-with-test-usetestng/28077602#28077602, 그러나 @amorfis는 문제를 재생산합니다. 여기에 어려울 수도 있습니다 :/ – Opal