Skip to content

Commit

Permalink
tests OK
Browse files Browse the repository at this point in the history
  • Loading branch information
echebbi committed Mar 26, 2024
1 parent d766121 commit a054648
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Feature: Mutation view shows analysis results
Then a coverage report is generated with 2 classes tested with overall coverage of 80% and mutation coverage of 0%
And the mutation results are
| status | project | package | class | line | mutation |
| SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional |
| SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | Replaced integer addition with subtraction |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | replaced int return with 0 for foo/bar/Bar::f |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Foo | 10 | Replaced integer addition with subtraction |
Expand All @@ -23,7 +23,7 @@ Feature: Mutation view shows analysis results
Scenario: Selecting a mutation opens the class in question at the right line number
When the following mutation is selected
| status | project | package | class | line | mutation |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false |
Then the file "Foo.java" is opened at line number 9

Scenario: Using the stronger mutators yields more mutation results
Expand All @@ -32,10 +32,10 @@ Feature: Mutation view shows analysis results
Then a coverage report is generated with 2 classes tested with overall coverage of 80% and mutation coverage of 0%
And the mutation results are
| status | project | package | class | line | mutation |
| SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional |
| SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional |
| SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with true |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false |
| SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with true |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | Replaced integer addition with subtraction |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Bar | 10 | replaced int return with 0 for foo/bar/Bar::f |
| NO_COVERAGE | project1 | foo.bar | foo.bar.Foo | 10 | Replaced integer addition with subtraction |
Expand All @@ -52,14 +52,14 @@ Feature: Mutation view shows analysis results
# And the mutation results are
# | status | project | package | class | line | mutation |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | Substituted 1 with 0 |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | negated conditional |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed call to java/util/ArrayList::size |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with false |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 9 | removed conditional - replaced equality check with true |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 12 | Substituted 0 with 1 |
# | SURVIVED | project1 | foo.bar | foo.bar.Bar | 12 | replaced return of integer sized value with (x == 0 ? 1 : 0) |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | Substituted 1 with 0 |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | negated conditional |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed call to java/util/ArrayList::size |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with false |
# | SURVIVED | project1 | foo.bar | foo.bar.Foo | 9 | removed conditional - replaced equality check with true |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public NoTestsFoundDialog(SWTWorkbenchBot bot) {
public void assertAppears() {
SWTBotShell shell = bot.shell("Pitclipse");
shell.activate();
bot.waitUntil(new DurationElapsed(500));
bot.label("No tests found");
bot.waitUntil(new DurationElapsed(500));
bot.button("OK").click();

bot.waitUntil(Conditions.shellCloses(shell));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
Expand Down Expand Up @@ -144,6 +145,7 @@ private void activateConfigurationTab(String configurationName, String name) {
}

public void createRunConfiguration(String configurationName, String projectName, String className) {
System.out.println("RunConfigurationSelector.createRunConfiguration()");
getPitConfigurationItem().contextMenu("New Configuration").click();
bot.textWithLabel("Name:").setText(configurationName);
PitRunConfiguration config = new Builder().withName(configurationName).withProjects(projectName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public List<PitRunConfiguration> runConfigurations() {

public void createRunConfiguration(String configurationName, String projectName, String className) {
try (RunConfigurationSelector selector = openRunMenu().andThen()) {
System.out.println("RunMenu.createRunConfiguration()");
selector.createRunConfiguration(configurationName, projectName, className);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,13 @@ public void defaultOptions() {
selector.close();
}

@Test
public void useOldDefaultsMutators() throws CoreException {
// set OLD_DEFAULTS mutators
PAGES.getWindowsMenu().setMutatorGroup(Mutators.OLD_DEFAULTS);
try {
runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT);
coverageReportGenerated(2, 80, 0, 8, 0);
mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 10 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | replaced return of integer sized value with (x == 0 ? 1 : 0)");
} finally {
// it's crucial to reset it to the default or we break other tests
PAGES.getWindowsMenu().setMutatorGroup(Mutators.DEFAULTS);
}
}

@Test
public void useDefaultMutators() throws CoreException {
runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT);
coverageReportGenerated(2, 80, 0, 6, 0);
mutationsAre(
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" +
Expand All @@ -111,10 +90,10 @@ public void useStrongerMutators() throws CoreException {
runPackageTest(FOO_BAR_PACKAGE, TEST_PROJECT);
coverageReportGenerated(2, 80, 0, 8, 0);
mutationsAre(
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with false\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 7 | removed conditional - replaced equality check with true\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" +
"SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with true\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | Replaced integer addition with subtraction\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Bar | 8 | replaced int return with 0 for foo/bar/Bar::f\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" +
Expand Down Expand Up @@ -188,7 +167,7 @@ public void launchConfigWithTargetClass() { // NOSONAR
// run test and confirm result is as expected
PAGES.getRunMenu().runPitWithConfiguration(TEST_CONFIG_NAME);
coverageReportGenerated(1, 80, 0, 3, 0);
mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | negated conditional\n" +
mutationsAre( "SURVIVED | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 7 | removed conditional - replaced equality check with false\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | Replaced integer addition with subtraction\n" +
"NO_COVERAGE | " + TEST_PROJECT + " | foo.bar | foo.bar.Foo | 8 | replaced int return with 0 for foo/bar/Foo::f");
}
Expand Down
Loading

0 comments on commit a054648

Please sign in to comment.