]
Chao Wang resolved WFLY-7741.
-----------------------------
Assignee: Chao Wang
Resolution: Rejected
The problem here is that it can not use assumption in @AfterClass method.
Only in @BeforeClass method is acceptable behavior
JUnit Assumptions with assume are broken in arq testcase for
@BeforeClass and @AfterClass
-----------------------------------------------------------------------------------------
Key: WFLY-7741
URL:
https://issues.jboss.org/browse/WFLY-7741
Project: WildFly
Issue Type: Bug
Components: Test Suite
Affects Versions: 10.1.0.Final
Reporter: Chao Wang
Assignee: Chao Wang
1. Write a simple unit test with JUnit assumptions in @BeforeClass and @AfterClass
methods.
{code:java}
@RunWith(Arquillian.class)
public class ArqAssumeInBeforeClassTestCase {
@BeforeClass
public static void beforeClass() throws IOException, InterruptedException {
Assume.assumeTrue(false); // this should skip
}
@AfterClass
public static void afterClass() throws IOException {
Assume.assumeTrue(false); // this should skip
}
@Test
public void test() {
}
}
{code}
2. Inside wildfly/testsuite run command:
mvn clean install -Dts.noSmoke -Dts.basic -Dtest=ArqAssumeInBeforeClassTestCase (for
example in basic ts)
3. You will see the AssumptionViolatedException from @BeforeClass and @AfterClass methods
as:
{noformat}
T E S T S
-------------------------------------------------------
Running
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.006 sec <<<
FAILURE! - in
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase
Time elapsed: 0.005 sec <<< ERROR!
org.junit.AssumptionViolatedException: got: <false>, expected: is <true>
at org.junit.Assume.assumeThat(Assume.java:95)
at org.junit.Assume.assumeTrue(Assume.java:41)
at
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase.beforeClass(ArqAssumeInBeforeClassTestCase.java:17)
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase
Time elapsed: 0.006 sec <<< ERROR!
org.junit.AssumptionViolatedException: got: <false>, expected: is <true>
at org.junit.Assume.assumeThat(Assume.java:95)
at org.junit.Assume.assumeTrue(Assume.java:41)
at
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase.afterClass(ArqAssumeInBeforeClassTestCase.java:22)
Results :
Tests in error:
org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase.org.jboss.as.test.integration.deployment.structure.war.ArqAssumeInBeforeClassTestCase
Run 1: ArqAssumeInBeforeClassTestCase.beforeClass:17 » AssumptionViolated got:
<false...
Run 2: ArqAssumeInBeforeClassTestCase.afterClass:22 » AssumptionViolated got:
<false>...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
{noformat}
However, the executions inside @BeforeClass and @AfterClass methods should simply be
skipped.
Example test
https://github.com/soul2zimate/wildfly/commits/ArqAssumeInBeforeClassTest...