Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: unit testing for diff-test-selection #980

Merged
merged 8 commits into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion .travis/travis-diff-test-selection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

DPSOT_VERSION=${1}

cd dspot-diff-test-selection/src/test/resources/tavern
cd dspot-diff-test-selection

mvn test

cd src/test/resources/tavern

mvn clean eu.stamp-project:dspot-diff-test-selection:${DSPOT_VERSION}:list -Dpath-dir-second-version="../tavern-refactor" eu.stamp-project:dspot-maven:${DSPOT_VERSION}:amplify-unit-tests -Dpath-to-test-list-csv=testsThatExecuteTheChange.csv -Dverbose -Dtest-criterion=ChangeDetectorSelector -Damplifiers=NumberLiteralAmplifier -Diteration=2 -Dabsolute-path-to-second-version=../tavern-refactor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public void instrumentAndRunTest(String pathToRootOfProject) {
pathToRootOfProject,
"clean",
"org.openclover:clover-maven-plugin:4.4.1:setup",
"test",
"-Drat.skip=true",
"-Djacoco.skip=true",
"-Danimal.sniffer.skip=true"
"test"
);
}

Expand All @@ -60,6 +57,7 @@ private int runGoals(String pathToRootOfProject, String... goals) {
properties.setProperty("findbugs.skip", "true");
properties.setProperty("gpg.skip", "true");
properties.setProperty("jacoco.skip", "true");
properties.setProperty("animal.sniffer.skip", "true");
request.setProperties(properties);

Invoker invoker = new DefaultInvoker();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package eu.stamp_project.diff_test_selection.clover;

import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertTrue;

public class CloverExectorTest {


@Test
public void test() {

/*
* Test the CloverExecutor : it runs openclover on the test suite
* The oracle is that the folder /target/clover exists
*/
final String pathToRootOfProject = "src/test/resources/tavern";
new CloverExecutor().instrumentAndRunTest(pathToRootOfProject);
assertTrue(new File(pathToRootOfProject + "/target/clover").exists());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package eu.stamp_project.diff_test_selection.clover;

import org.junit.Test;

import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertFalse;

public class CloverReaderTest {

@Test
public void test() {

/*
* Read a clover report and return the coverage
*/

final Map<String, Map<String, Map<String, List<Integer>>>> coverage = new CloverReader().read("src/test/resources/clover_report");
assertFalse(coverage.isEmpty());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package eu.stamp_project.diff_test_selection.diff;

import org.junit.Test;

import java.io.File;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class DiffComputerTest {

@Test
public void test() {
final File file = new File("src/test/resources/tavernpatch.diff");
file.delete();
assertFalse(file.exists());
new DiffComputer()
.computeDiffWithDiffCommand(new File("src/test/resources/tavern"), new File("src/test/resources/tavern-refactor"));
assertTrue(file.exists());
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading