Changeset 18870 in josm for trunk/test/performance


Ignore:
Timestamp:
2023-10-16T15:19:07+02:00 (13 months ago)
Author:
taylor.smock
Message:

See #16567: Update to JUnit 5

This converts most tests to use @Annotations. There are also some performance
improvements as it relates to tests.

Location:
trunk/test/performance/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java

    r18690 r18870  
    1717import org.junit.jupiter.api.Test;
    1818import org.junit.jupiter.api.Timeout;
    19 import org.junit.jupiter.api.extension.RegisterExtension;
    2019import org.openstreetmap.josm.PerformanceTestUtils;
    2120import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
    2221import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
    23 import org.openstreetmap.josm.testutils.JOSMTestRules;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2423
    2524import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    2928 * @author Michael Zangl
    3029 */
     30@Projection
    3131@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3232class KeyValuePerformanceTest {
     
    4040
    4141    /**
    42      * Prepare the test.
    43      */
    44     @RegisterExtension
    45     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    46     public JOSMTestRules test = new JOSMTestRules().projection();
    47 
    48     /**
    4942     * See if there is a big difference between Strings that are interned and those that are not.
    5043     */
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r18690 r18870  
    1717import org.junit.jupiter.api.Test;
    1818import org.junit.jupiter.api.Timeout;
    19 import org.openstreetmap.josm.JOSMFixture;
    2019import org.openstreetmap.josm.PerformanceTestUtils;
    2120import org.openstreetmap.josm.data.Bounds;
     
    2524import org.openstreetmap.josm.io.Compression;
    2625import org.openstreetmap.josm.io.OsmReader;
     26import org.openstreetmap.josm.testutils.annotations.Projection;
     27import org.openstreetmap.josm.testutils.annotations.Territories;
    2728
    2829import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3132 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
    3233 */
     34@Projection
     35@Territories
    3336@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3437abstract class AbstractMapRendererPerformanceTestParent {
     
    4952
    5053    protected static void load() throws Exception {
    51         JOSMFixture.createPerformanceTestFixture().init(true);
    5254        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    5355        g = (Graphics2D) img.getGraphics();
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r18690 r18870  
    1919import java.util.Locale;
    2020import java.util.Map;
     21import java.util.concurrent.TimeUnit;
    2122import java.util.stream.Collectors;
    2223
     
    2627import org.junit.jupiter.api.BeforeAll;
    2728import org.junit.jupiter.api.Test;
    28 import org.junit.jupiter.api.extension.RegisterExtension;
    29 import org.openstreetmap.josm.JOSMFixture;
     29import org.junit.jupiter.api.Timeout;
    3030import org.openstreetmap.josm.PerformanceTestUtils;
    3131import org.openstreetmap.josm.TestUtils;
     
    4444import org.openstreetmap.josm.gui.mappaint.mapcss.Selector;
    4545import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement;
    46 import org.openstreetmap.josm.testutils.JOSMTestRules;
     46import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
     47import org.openstreetmap.josm.testutils.annotations.Main;
     48import org.openstreetmap.josm.testutils.annotations.Projection;
     49import org.openstreetmap.josm.testutils.annotations.Territories;
    4750
    4851import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    5154 * Performance test of map renderer.
    5255 */
     56@BasicPreferences
     57@Main
     58@Projection
     59@Territories
     60@Timeout(value = 15, unit = TimeUnit.MINUTES)
    5361public class MapRendererPerformanceTest {
    5462
     
    8290
    8391    /**
    84      * Setup tests
    85      */
    86     @RegisterExtension
    87     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    88     public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().preferences().timeout(15 * 60 * 1000);
    89 
    90     /**
    9192     * Initializes test environment.
    9293     * @throws Exception if any error occurs
     
    9495    @BeforeAll
    9596    public static void load() throws Exception {
    96         JOSMFixture.createPerformanceTestFixture().init(true);
    97 
    9897        img = new BufferedImage(IMG_WIDTH, IMG_HEIGHT, BufferedImage.TYPE_INT_ARGB);
    9998        g = (Graphics2D) img.getGraphics();
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSPerformanceTest.java

    r17615 r18870  
    1111
    1212import org.junit.jupiter.api.Test;
    13 import org.junit.jupiter.api.BeforeAll;
    14 import org.openstreetmap.josm.JOSMFixture;
    1513import org.openstreetmap.josm.PerformanceTestUtils;
    1614import org.openstreetmap.josm.data.Bounds;
     
    2220import org.openstreetmap.josm.gui.mappaint.MapRendererPerformanceTest;
    2321import org.openstreetmap.josm.io.IllegalDataException;
     22import org.openstreetmap.josm.testutils.annotations.Projection;
    2423
    2524/**
     
    2827 *
    2928 */
     29@Projection
    3030class MapCSSPerformanceTest {
    3131
     
    4646                      "Please update configuration settings in the unit test file.");
    4747          }
    48     }
    49 
    50     /**
    51      * Setup test.
    52      */
    53     @BeforeAll
    54     public static void createJOSMFixture() {
    55         JOSMFixture.createPerformanceTestFixture().init(true);
    5648    }
    5749
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r18690 r18870  
    44import java.util.concurrent.TimeUnit;
    55
    6 import org.junit.jupiter.api.BeforeAll;
    76import org.junit.jupiter.api.Test;
    87import org.junit.jupiter.api.Timeout;
    9 import org.openstreetmap.josm.JOSMFixture;
    108import org.openstreetmap.josm.PerformanceTestUtils;
    119import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
     
    1311import org.openstreetmap.josm.data.osm.OsmDataGenerator.KeyValueDataGenerator;
    1412import org.openstreetmap.josm.gui.mappaint.MultiCascade;
     13import org.openstreetmap.josm.testutils.annotations.Projection;
    1514
    1615/**
     
    1817 * @author Michael Zangl
    1918 */
     19@Projection
    2020@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2121class MapCSSStyleSourceFilterTest {
     
    8282
    8383    /**
    84      * Prepare the test.
    85      */
    86     @BeforeAll
    87     public static void createJOSMFixture() {
    88         JOSMFixture.createPerformanceTestFixture().init(true);
    89     }
    90 
    91     /**
    9284     * Time how long it takes to evaluate [key=value] rules
    9385     */
Note: See TracChangeset for help on using the changeset viewer.