Skip to content

Commit

Permalink
Add JUnit5 tags to integration tests, functional tests, and performan…
Browse files Browse the repository at this point in the history
…ce tests

This should allow contributors to filter out integration tests inside the standard
test directory. Of specific note, this should reduce test runtime for contributors
by a non-trivial amount if contributors filter out the tagged tests.

For consistencies’ sake, tests in `functional` and `performance` were also
annotated. As such, if we ever merge the test directories, this will let us
filter which tests are run in CI.

Note that many functional tests don't have the annotation. This is because they
are ''manual'' tests.

git-svn-id: https://josm.openstreetmap.de/svn/trunk@19223 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
taylor.smock committed Sep 17, 2024
1 parent 8896d5c commit 8cd4bbc
Show file tree
Hide file tree
Showing 40 changed files with 153 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
import org.openstreetmap.josm.data.osm.search.SearchCompiler;
import org.openstreetmap.josm.io.OsmReader;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.IntegrationTest;

/**
* Test of boundaries OSM file.
*/
@BasicPreferences
@FunctionalTest
@IntegrationTest
class BoundariesTestIT {

private static final List<String> RETIRED_ISO3166_1_CODES = Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@
import org.junit.jupiter.api.Timeout;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.IntegrationTest;
import org.openstreetmap.josm.tools.HttpClient;

/**
* Automatic test of imagery synchronization between JOSM and ELI.
* See <a href="https://josm.openstreetmap.de/wiki/ImageryCompare">JOSM wiki</a>
*/
@BasicPreferences
@FunctionalTest
@IntegrationTest
@Timeout(60)
class ImageryCompareTestIT {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException;
import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.Territories;
import org.openstreetmap.josm.tools.HttpClient;

Expand All @@ -29,6 +30,7 @@
* Various integration tests with Taginfo.
*/
@BasicPreferences
@FunctionalTest
@Timeout(20)
@Territories
class TaginfoTestIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;

/**
* Tests the {@link GettingStarted} class.
*/
@FunctionalTest
class GettingStartedTest {
/**
* Tests that image links are replaced.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.openstreetmap.josm.io.IllegalDataException;
import org.openstreetmap.josm.io.OsmReader;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.tools.Utils;

Expand All @@ -43,6 +44,7 @@
* @author Michael Zangl
*/
@BasicPreferences
@FunctionalTest
@Projection
public class MapCSSRendererTest {
private static final String TEST_DATA_BASE = "/renderer/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.openstreetmap.josm.io.IllegalDataException;
import org.openstreetmap.josm.io.OsmReader;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.Main;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.tools.Pair;
Expand All @@ -39,6 +40,7 @@
* Test {@link StyleCache}.
*/
@BasicPreferences
@FunctionalTest
@Main
@org.openstreetmap.josm.testutils.annotations.MapPaintStyles
@Projection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.gui.util.GuiHelper;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.TestUser;
import org.openstreetmap.josm.tools.Logging;

Expand All @@ -56,6 +57,7 @@
/**
* Unit tests of {@link MultiFetchServerObjectReader}.
*/
@FunctionalTest
@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
@Timeout(value = 1, unit = TimeUnit.MINUTES)
@org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.DEV)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.openstreetmap.josm.data.projection.Projections;
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.TestUser;
import org.openstreetmap.josm.tools.JosmRuntimeException;
import org.openstreetmap.josm.tools.Logging;
Expand All @@ -51,6 +52,7 @@
* Reads primitives referring to a particular primitive (ways including a node, relations referring to a relation)
* @since 1806
*/
@FunctionalTest
@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
@org.openstreetmap.josm.testutils.annotations.OsmApi(org.openstreetmap.josm.testutils.annotations.OsmApi.APIType.DEV)
@TestUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import org.junit.jupiter.api.Disabled;
import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.tools.Logging;

@FunctionalTest
@Disabled
class UploadStrategySelectionPanelTest extends JFrame {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.openstreetmap.josm.gui.progress.ProgressMonitor;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.HTTP;
import org.openstreetmap.josm.tools.HttpClient.Response;

Expand All @@ -64,6 +65,7 @@
@HTTP
@BasicWiremock
@BasicPreferences
@FunctionalTest
@Timeout(15)
class HttpClientTest {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset;
import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
import org.openstreetmap.josm.gui.tagging.presets.items.Key;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.xml.sax.SAXException;

import com.kitfox.svg.SVGConst;
Expand All @@ -42,6 +43,7 @@
/**
* Unit tests of {@link ImageProvider} class.
*/
@FunctionalTest
class ImageProviderTest {
private static final class LogHandler14319 extends Handler {
boolean failed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.Test;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;
import org.openstreetmap.josm.testutils.annotations.IntegrationTest;

/**
* Integration tests of {@link ImageProvider} class.
*/
@FunctionalTest
@IntegrationTest
class ImageProviderTestIT {
/**
* Test fetching an image using {@code wiki://} protocol.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openstreetmap.josm.testutils.annotations.FunctionalTest;

/**
* Unit tests of {@link ImageProvider} class for manual execution.
*/
@FunctionalTest
class ImageProviderTestManual {
/**
* Test getting a cursor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.openstreetmap.josm.PerformanceTestUtils;
import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
Expand All @@ -27,6 +28,7 @@
* This test measures the performance of {@link OsmPrimitive#get(String)} and related.
* @author Michael Zangl
*/
@PerformanceTest
@Projection
@Timeout(value = 15, unit = TimeUnit.MINUTES)
class KeyValuePerformanceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import org.openstreetmap.josm.data.coor.LatLonTest;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* Checks that rounding of coordinates is not too slow.
*/
@PerformanceTest
class RoundingPerformanceTest {

private static double oldRoundToOsmPrecision(double value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.io.Compression;
import org.openstreetmap.josm.io.OsmReader;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.Territories;

Expand All @@ -31,6 +32,7 @@
/**
* Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
*/
@PerformanceTest
@Projection
@Territories
@Timeout(value = 15, unit = TimeUnit.MINUTES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* Performance test of {@code StyledMapRenderer}.
*/
@PerformanceTest
class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* Performance test of {@code WireframeMapRenderer}.
*/
@PerformanceTest
class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.Territories;

/**
* Performance test of {@code ValidationTask}.
*/
@BasicPreferences
@PerformanceTest
@Projection
@Territories
class ValidationTaskPerformanceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import org.openstreetmap.josm.PerformanceTestUtils;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.Territories;

/**
* Performance test of {@code MapCSSTagChecker}.
*/
@BasicPreferences
@PerformanceTest
@Projection
@Territories
class MapCSSTagCheckerPerformanceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
import org.openstreetmap.josm.testutils.annotations.Main;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;
import org.openstreetmap.josm.testutils.annotations.Territories;

Expand All @@ -55,6 +56,7 @@
*/
@BasicPreferences
@Main
@PerformanceTest
@Projection
@Territories
@Timeout(value = 15, unit = TimeUnit.MINUTES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import org.junit.jupiter.api.Test;
import org.openstreetmap.josm.PerformanceTestUtils;
import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* Performance test of MapCSS Condition objects.
* @author Michael Zangl
*/
@PerformanceTest
class MapCSSConditionPerformanceTest {
/**
* Test the performance of all OP entries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
import org.openstreetmap.josm.gui.NavigatableComponent;
import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest;
import org.openstreetmap.josm.io.IllegalDataException;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;

/**
* This performance test measures the time for a full run of MapPaintVisitor.visitAll()
* against a test data set using a test style.
*
*/
@PerformanceTest
@Projection
class MapCSSPerformanceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import org.openstreetmap.josm.data.osm.OsmDataGenerator;
import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
import org.openstreetmap.josm.gui.mappaint.MultiCascade;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;
import org.openstreetmap.josm.testutils.annotations.Projection;

/**
* Tests how fast {@link MapCSSStyleSource} finds the right style candidates for one object.
* @author Michael Zangl
*/
@PerformanceTest
@Projection
@Timeout(value = 15, unit = TimeUnit.MINUTES)
class MapCSSStyleSourceFilterPerformanceTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.openstreetmap.josm.PerformanceTestUtils;
import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* This test tests how fast we are at reading an OSM file.
Expand All @@ -24,6 +25,7 @@
*
* @author Michael Zangl
*/
@PerformanceTest
@Timeout(value = 15, unit = TimeUnit.MINUTES)
class OsmReaderPerformanceTest {
private static final int TIMES = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import org.openstreetmap.josm.PerformanceTestUtils;
import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.testutils.annotations.PerformanceTest;

/**
* This test tests how fast we are at writing an OSM file.
* <p>
* For this, we use the neubrandenburg-file, which is a good real world example of an OSM file.
*/
@PerformanceTest
@Timeout(value = 15, unit = TimeUnit.MINUTES)
class OsmWriterPerformanceTest {
private static final int TIMES = 4;
Expand Down
Loading

0 comments on commit 8cd4bbc

Please sign in to comment.