Skip to content

Commit

Permalink
Mark slow and resource intensive tests with a JUnit test category
Browse files Browse the repository at this point in the history
Mark JobManagerLoadTest as a resource intensive test as it requires up
to 25k native threads.
Mark tests which require more than five seconds to be executed as slow
tests.

Change-Id: I45773bd89763b98d195753b915768d57a217533e
Reviewed-on: https://git.eclipse.org/r/161036
Tested-by: CI Bot
Reviewed-by: Beat Schwarzentrub <bsh@bsiag.com>
  • Loading branch information
Ralph Steiner committed Apr 16, 2020
1 parent 6afa53b commit d56edb4
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,22 @@
import org.eclipse.scout.rt.testing.platform.runner.parameterized.IScoutTestParameter;
import org.eclipse.scout.rt.testing.platform.runner.parameterized.NonParameterized;
import org.eclipse.scout.rt.testing.platform.runner.parameterized.ParameterizedPlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.eclipse.scout.rt.testing.platform.util.BlockingCountDownLatch;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Category(SlowTest.class)
@RunWith(ParameterizedPlatformTestRunner.class)
public class JmsMomImplementorTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.eclipse.scout.rt.testing.platform.testcategory;

import org.junit.experimental.categories.Category;

/**
* Marker interface for test categories used with JUnit {@link Category}
*/
public interface ITestCategory {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.eclipse.scout.rt.testing.platform.testcategory;

import org.junit.experimental.categories.Category;

/**
* A marker interface for tests which require a lot of system resource. Some test environments have strict resource
* limits and may not be able to provide e.g. 10k native threads. Test which require a lot of threads, cpu or memory
* should be tagged with this category.
* <p>
* Used together with {@link Category} annotation in unit-tests.
*/
public interface ResourceIntensiveTest extends ITestCategory {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.eclipse.scout.rt.testing.platform.testcategory;

import org.junit.experimental.categories.Category;

/**
* A marker interface for tests which require a lot of time to be executed. These tests can be excluded during
* continuous builds but are run on a daily basis. Try to avoid this category by rewriting tests.
* <p>
* Used together with {@link Category} annotation in unit-tests.
*/
public interface SlowTest extends ITestCategory {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
import org.eclipse.scout.rt.platform.util.concurrent.FutureCancelledError;
import org.eclipse.scout.rt.platform.util.concurrent.IRunnable;
import org.eclipse.scout.rt.platform.util.concurrent.ThreadInterruptedError;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(SlowTest.class)
public class JobFutureTaskTest {
private static final int ROUNDS = 100000;
private static final String TEST_HINT = "JobFutureTaskTest_testRaceConditionOnCancelWithJobManager";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
import org.eclipse.scout.rt.platform.util.concurrent.IRunnable;
import org.eclipse.scout.rt.platform.util.concurrent.TimedOutError;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.testcategory.ResourceIntensiveTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

@Category(ResourceIntensiveTest.class) // uses up to 25k native threads
@RunWith(PlatformTestRunner.class)
public class JobManagerLoadTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
import org.eclipse.scout.rt.platform.util.concurrent.IRunnable;
import org.eclipse.scout.rt.testing.platform.runner.JUnitExceptionHandler;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.quartz.SimpleScheduleBuilder;

@Category(SlowTest.class)
@RunWith(PlatformTestRunner.class)
public class ScheduleAtFixedRateTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
import org.eclipse.scout.rt.platform.util.concurrent.IRunnable;
import org.eclipse.scout.rt.testing.platform.runner.JUnitExceptionHandler;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

@Category(SlowTest.class)
@RunWith(PlatformTestRunner.class)
public class ScheduleWithFixedDelayTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@
import org.eclipse.scout.rt.testing.platform.job.JobTestUtil;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.runner.Times;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.eclipse.scout.rt.testing.platform.util.BlockingCountDownLatch;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;

@Category(SlowTest.class)
@RunWith(PlatformTestRunner.class)
public class ExecutionSemaphoreTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
import org.eclipse.scout.rt.platform.job.Jobs;
import org.eclipse.scout.rt.platform.util.concurrent.IRunnable;
import org.eclipse.scout.rt.testing.platform.runner.PlatformTestRunner;
import org.eclipse.scout.rt.testing.platform.testcategory.SlowTest;
import org.eclipse.scout.rt.testing.platform.util.BlockingCountDownLatch;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.SimpleTrigger;

@Category(SlowTest.class)
@RunWith(PlatformTestRunner.class)
public class SerialFutureExecutionTest {

Expand Down

0 comments on commit d56edb4

Please sign in to comment.