I'm exploring Gradle as a replacement for my existing ant build. We have 
several tests that must be skipped under certain circumstances. We've 
implemented this using org.junit.Assume. When I run gradle build against a 
project containing this test:

import org.junit.Assume;

public class MyAssumptionJUnitTest extends TestCase {

    public void testAssumeClause(){
        Assume.assumeTrue( false );
    }

}

The build terminates with output like this:

:AptHst:testClasses
:AptHst:test
Test edu.stsci.hst.apt.controller.HstServerAvailabilityJUnitTest FAILED
7 tests completed, 4 failures

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':AptHst:test'.
Cause: There were failing tests. See the report at 
/Users/spina/Code/apt/StagingGround/AptHst/build/reports/tests.


The testing report contains a stack trace like this:

org.junit.Assume$AssumptionViolatedException: got: <false>, expected: is <true>
        at org.junit.Assume.assumeThat(Assume.java:42)
        at org.junit.Assume.assumeTrue(Assume.java:54)
        at 
edu.stsci.util.Assumptions.assumeThatNetworkConnectionAvailable(Assumptions.java:17)
        at 
edu.stsci.hst.apt.controller.HstServerAvailabilityJUnitTest.testBot2MassAvailable(HstServerAvailabilityJUnitTest.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
        at 
org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)
        at 
org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)

Is this a known problem? Is it intentional? Can I configure it?

Thanks,

Andy

Reply via email to