Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</dependency>
<dependency>
<groupId>de.jplag</groupId>
<artifactId>endtoend-testing</artifactId>
<artifactId>regression-tests</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
<module>cli</module>
<module>core</module>
<module>coverage-report</module>
<module>endtoend-testing</module>
<module>regression-tests</module>
<module>languages</module>
<module>language-api</module>
<module>language-antlr-utils</module>
Expand Down
14 changes: 8 additions & 6 deletions endtoend-testing/README.md → regression-tests/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# JPlag - End-To-End Testing
# JPlag - Regression tests

The end-to-end test module contains tests that report any chance in the similarities reported by JPlag.
The regression-tests module contains tests that report any chance in the similarities reported by JPlag.
There are two kinds of tests:
1. Simple tests that fail if the similarity between two submissions changed
2. Gold standard tests

In addition to that this module also contains architecture tests

## Gold standard tests

A gold standard test serves as a metric for the change in detection quality. It needs a list of plagiarism instances in the data set.
Expand All @@ -13,8 +15,8 @@ The test will fail if the average similarity on one of those groups changed. In

## Updating tests

If the similarities reported by JPlag change and these changes are wanted, the reference values for the end-to-end tests need to be updated.
To do that the test in [EndToEndGeneratorTest.java](src/test/java/de/jplag/endtoend/EndToEndGeneratorTest.java) have to be executed.
If the similarities reported by JPlag change and these changes are wanted, the reference values for the regression tests need to be updated.
To do that the test in [RegressionGeneratorTest.java](src/test/java/de/jplag/regression_test/RegressionGeneratorTest.java) have to be executed.
This will generate new reference files.

## Adding new tests
Expand Down Expand Up @@ -68,9 +70,9 @@ More detailed information about the creation as well as about the subject of the

### Creating The Plagiarism

Before you add a new language to the end-to-end tests, I would like to point out that the quality of the tests depends dreadfully on the plagiarism techniques you choose, which were explained in section [Steps Towards Plagiarism](#steps-towards-plagiarism).
Before you add a new language to the regression tests, I would like to point out that the quality of the tests depends dreadfully on the plagiarism techniques you choose, which were explained in section [Steps Towards Plagiarism](#steps-towards-plagiarism).
If you need more information about creating plans for this purpose, you can also read the elaborations that can be found under [References](#references).
The more various changes you apply, the more accurate the end-to-end tests for the language will be.
The more various changes you apply, the more accurate the regression tests for the language will be.

In the following, an example is shown, which is in the JavaEndToEnd tests and is used.

Expand Down
2 changes: 1 addition & 1 deletion endtoend-testing/pom.xml → regression-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>aggregator</artifactId>
<version>${revision}</version>
</parent>
<artifactId>endtoend-testing</artifactId>
<artifactId>regression-tests</artifactId>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.constants;
package de.jplag.regression_test.constants;
Comment thread
Kr0nox marked this conversation as resolved.
Outdated

import java.nio.file.Path;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.helper;
package de.jplag.regression_test.helper;

import java.util.DoubleSummaryStatistics;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.helper;
package de.jplag.regression_test.helper;

import java.io.File;
import java.io.FileOutputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.helper;
package de.jplag.regression_test.helper;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.helper;
package de.jplag.regression_test.helper;

import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -7,7 +7,7 @@
import de.jplag.Submission;

/**
* Helper class to perform all necessary additional functions for the endToEnd tests.
* Helper class to perform all necessary additional functions for the regression tests.
*/
public final class TestSuiteHelper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.helper;
package de.jplag.regression_test.helper;

import java.io.File;
import java.io.IOException;
Expand All @@ -14,7 +14,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.jplag.endtoend.model.DataSet;
import de.jplag.regression_test.model.DataSet;

/**
* Manages unzip operations with caching for datasets.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.io.File;
import java.io.FileNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.io.File;
import java.io.IOException;
Expand All @@ -8,15 +8,15 @@
import java.util.Set;

import de.jplag.Language;
import de.jplag.endtoend.constants.TestDirectoryConstants;
import de.jplag.endtoend.helper.LanguageDeserializer;
import de.jplag.endtoend.helper.UnzipManager;
import de.jplag.regression_test.constants.TestDirectoryConstants;
import de.jplag.regression_test.helper.LanguageDeserializer;
import de.jplag.regression_test.helper.UnzipManager;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

/**
* Represents a data set for the end-to-end test suite.
* Represents a data set for the regression test suite.
* @param name the dataset name (required)
* @param language the programming language of the dataset (required)
* @param format the format of the dataset (required)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.io.File;
import java.io.IOException;
Expand All @@ -9,7 +9,7 @@
import de.jplag.options.JPlagOptions;

/**
* A run configuration for the end-to-end tests.
* A run configuration for the regression tests.
* @param jPlagOptions The jplag options to use
* @param identifier The identifier for the configuration
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import de.jplag.JPlagComparison;
import de.jplag.options.SimilarityMetric;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* contains the current comparative values for the endToEnd tests. Represents the expected result metrics for similarity
* comparison. The comparative values were determined by discussion which can be found at
* contains the current comparative values for the regression tests. Represents the expected result metrics for
* similarity comparison. The comparative values were determined by discussion which can be found at
* <a href="https://github.com/jplag/JPlag/issues/548">GitHub</a>.Here this object is used for serialization and
* deserialization of the information from json to object or object to json.
* @param resultSimilarityMinimum the minimum expected similarity value
Expand All @@ -26,7 +26,7 @@ public double getSimilarityForMetric(SimilarityMetric metric) {
return switch (metric) {
case AVG -> (resultSimilarityMinimum() + resultSimilarityMaximum()) / 2.0;
case MAX -> resultSimilarityMaximum();
default -> throw new IllegalArgumentException(String.format("Similarity metric %s not supported for end to end tests", metric.name()));
default -> throw new IllegalArgumentException(String.format("Similarity metric %s not supported for regression tests", metric.name()));
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.util.Collection;
import java.util.DoubleSummaryStatistics;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.util.Arrays;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* The object contains required options for the endToEnd tests which are important for the test suite.
* The object contains required options for the regression tests which are important for the test suite.
* @param minimumTokenMatches an array of minimum token match thresholds
* @param baseCodeDirectory the base directory path for code files
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.model;
package de.jplag.regression_test.model;

/**
* Enum representing storage formats for datasets or files.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend;
package de.jplag.regression_test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -19,17 +19,17 @@
import de.jplag.JPlag;
import de.jplag.JPlagComparison;
import de.jplag.JPlagResult;
import de.jplag.endtoend.constants.TestDirectoryConstants;
import de.jplag.endtoend.helper.FileHelper;
import de.jplag.endtoend.helper.TestSuiteHelper;
import de.jplag.endtoend.model.ComparisonIdentifier;
import de.jplag.endtoend.model.DataSet;
import de.jplag.endtoend.model.DataSetRunConfiguration;
import de.jplag.endtoend.model.ExpectedResult;
import de.jplag.endtoend.model.GoldStandard;
import de.jplag.endtoend.model.ResultDescription;
import de.jplag.exceptions.ExitException;
import de.jplag.options.JPlagOptions;
import de.jplag.regression_test.constants.TestDirectoryConstants;
import de.jplag.regression_test.helper.FileHelper;
import de.jplag.regression_test.helper.TestSuiteHelper;
import de.jplag.regression_test.model.ComparisonIdentifier;
import de.jplag.regression_test.model.DataSet;
import de.jplag.regression_test.model.DataSetRunConfiguration;
import de.jplag.regression_test.model.ExpectedResult;
import de.jplag.regression_test.model.GoldStandard;
import de.jplag.regression_test.model.ResultDescription;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
Expand All @@ -38,10 +38,10 @@
* Test class for automatically generating the JSON file describing the expected results. To generate a result JSON,
* adapt the DATA_SET constant.
*/
class EndToEndGeneratorTest {
class RegressionGeneratorTest {
private static final String DATA_SET = "progpedia";

private static final Logger logger = LoggerFactory.getLogger(EndToEndGeneratorTest.class);
private static final Logger logger = LoggerFactory.getLogger(RegressionGeneratorTest.class);

@Disabled("only enable to generate result json file")
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend;
package de.jplag.regression_test;

import static de.jplag.options.SimilarityMetric.MAX;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -31,28 +31,28 @@
import de.jplag.JPlagResult;
import de.jplag.Language;
import de.jplag.Submission;
import de.jplag.endtoend.constants.TestDirectoryConstants;
import de.jplag.endtoend.helper.DeltaSummaryStatistics;
import de.jplag.endtoend.helper.FileHelper;
import de.jplag.endtoend.helper.TestSuiteHelper;
import de.jplag.endtoend.model.ComparisonIdentifier;
import de.jplag.endtoend.model.DataSet;
import de.jplag.endtoend.model.DataSetRunConfiguration;
import de.jplag.endtoend.model.ExpectedResult;
import de.jplag.endtoend.model.GoldStandard;
import de.jplag.endtoend.model.ResultDescription;
import de.jplag.exceptions.ExitException;
import de.jplag.options.JPlagOptions;
import de.jplag.options.SimilarityMetric;
import de.jplag.regression_test.constants.TestDirectoryConstants;
import de.jplag.regression_test.helper.DeltaSummaryStatistics;
import de.jplag.regression_test.helper.FileHelper;
import de.jplag.regression_test.helper.TestSuiteHelper;
import de.jplag.regression_test.model.ComparisonIdentifier;
import de.jplag.regression_test.model.DataSet;
import de.jplag.regression_test.model.DataSetRunConfiguration;
import de.jplag.regression_test.model.ExpectedResult;
import de.jplag.regression_test.model.GoldStandard;
import de.jplag.regression_test.model.ResultDescription;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
* Main test suite for end-to-end testing over all languages. The test suite aims to detect changes regarding the
* Main test suite for regression testing over all languages. The test suite aims to detect changes regarding the
* detection quality of JPlag. Artificial plagiarisms are compared with the original code. The results are compared with
* previous ones stored in the resource folder.
*/
class EndToEndSuiteTest {
class RegressionSuiteTest {
private static final double EPSILON = 1E-6;

/**
Expand All @@ -62,7 +62,7 @@ class EndToEndSuiteTest {
* @throws IOException If loading test resources fails
*/
@TestFactory
Collection<DynamicContainer> endToEndTestFactory() throws ExitException, IOException {
Collection<DynamicContainer> regressionTestFactory() throws ExitException, IOException {
File descriptorDirectory = TestDirectoryConstants.BASE_PATH_TO_DATA_SET_DESCRIPTORS.toFile();
List<File> testDescriptorFiles = Arrays.asList(Objects.requireNonNull(descriptorDirectory.listFiles()));
List<DynamicContainer> allTests = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.jplag.endtoend.architecture;
package de.jplag.regression_test.architecture;

import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.fields;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
Expand Down
Loading