[
https://issues.apache.org/jira/browse/IGNITE-10178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16723863#comment-16723863
]
Oleg Ignatenko commented on IGNITE-10178:
-----------------------------------------
(i) Note that in JUnit 4 an idiomatic way to ignore tests depending on runtime
conditions is by using
[Assume|https://junit.org/junit4/javadoc/4.12/org/junit/Assume.html] API.
See code snippet demonstrating how it works: {code}
import org.junit.Test;
import static org.junit.Assume.assumeTrue;
public class AssumeDemo {
@Test
public void assume1() {
assumeTrue("", runtimeCondition(1));
System.out.println("assume 1");
}
@Test
public void assume2() {
assumeTrue("", runtimeCondition(2));
System.out.println("assume 2");
}
private boolean runtimeCondition(int val) {
boolean res = (val & 1) == 0;
System.out.println("Runtime condition holds: " + res);
return res;
}
}{code}
The output when executing this code is as follows: {noformat}
Runtime condition holds: false
Test ignored.
org.junit.internal.AssumptionViolatedException:
at org.junit.Assume.assumeTrue(Assume.java:59)
at org.apache.ignite.ml.common.AssumeDemo.assume1(AssumeDemo.java:10)
...
Runtime condition holds: true
assume 2{noformat}
> change tests that fail("Ignite JIRA ticket URL") to @Ignore("Ignite JIRA
> ticket URL")
> -------------------------------------------------------------------------------------
>
> Key: IGNITE-10178
> URL: https://issues.apache.org/jira/browse/IGNITE-10178
> Project: Ignite
> Issue Type: Sub-task
> Reporter: Oleg Ignatenko
> Assignee: PetrovMikhail
> Priority: Major
>
> Change tests that use {{fail("Ignite JIRA ticket URL")}} to {{@Ignore("Ignite
> JIRA ticket URL")}}. Do the same change for tests that fail by
> {{@IgniteIgnore("Ignite JIRA ticket URL")}}, like for example
> [S3CheckpointSpiStartStopSelfTest.testStartStop|https://github.com/apache/ignite/blob/master/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java].
> Also, use
> [Ignore|http://junit.sourceforge.net/javadoc/org/junit/Ignore.html] to
> annotate empty test classes in examples that were discovered and re-muted per
> IGNITE-10174.
> If needed, refer parent task for more details.
> Note this step would better be coordinated with Teamcity and TC bot
> maintainers because it may substantially impact them
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)