Skip to content

Commit

Permalink
Migrate compare performance tests to JUnit 5
Browse files Browse the repository at this point in the history
The performance test in org.eclipse.compare.tests still relies on the
JUnit 3 PerformanceTestCase. This change migrates the compare
performance test and test suite to JUnit 5.
  • Loading branch information
HeikoKlare authored and akurtakov committed Oct 27, 2023
1 parent 191e96b commit 4e9eaab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions team/tests/org.eclipse.compare.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Require-Bundle: org.junit,
org.eclipse.core.tests.harness,
org.eclipse.core.filesystem,
org.eclipse.team.ui
Import-Package: org.junit.jupiter.api,
org.junit.platform.suite.api
Bundle-Activator: org.eclipse.compare.tests.CompareTestPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %providerName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@
*******************************************************************************/
package org.eclipse.compare.tests.performance;

import junit.framework.Test;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

import junit.framework.TestSuite;

/**
* @since 3.1
*/
@Suite
@SelectClasses({RangeDifferencerTest.class})
public class PerformanceTestSuite extends TestSuite {

public static Test suite() {
TestSuite suite= new TestSuite("Compare performance tests"); //$NON-NLS-1$
//$JUnit-BEGIN$
suite.addTestSuite(RangeDifferencerTest.class);
//$JUnit-END$
return suite;
}
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.compare.tests.performance;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.eclipse.compare.contentmergeviewer.ITokenComparator;
import org.eclipse.compare.internal.DocLineComparator;
import org.eclipse.compare.rangedifferencer.RangeDifference;
Expand All @@ -21,17 +23,14 @@
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.test.performance.Dimension;
import org.eclipse.test.performance.PerformanceTestCase;
import org.eclipse.test.performance.PerformanceTestCaseJunit5;
import org.junit.jupiter.api.Test;

public class RangeDifferencerTest extends PerformanceTestCase {
public class RangeDifferencerTest extends PerformanceTestCaseJunit5 {


// static private final String EXPLANATION = "Performance decrease caused by changes in the compare framework, see bug 210688";

public RangeDifferencerTest(String name) {
super(name);
}

/*
* Creates document with 5000 lines.
* Parameter code determines where additional lines are added.
Expand Down Expand Up @@ -62,6 +61,7 @@ private IDocument createDocument(int code) {
return new Document(sb.toString());
}

@Test
public void testLargeDocument() {

tagAsGlobalSummary("3-way compare, 5000 lines", Dimension.ELAPSED_PROCESS); //$NON-NLS-1$
Expand Down

0 comments on commit 4e9eaab

Please sign in to comment.