Skip to content

Commit

Permalink
205: run PIT with "Run" toolbar button
Browse files Browse the repository at this point in the history
Task-Url: #205
  • Loading branch information
LorenzoBettini committed Aug 25, 2022
1 parent beb2bb9 commit 777b2c9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ public void runPitAndWaitForIt(Runnable runnable, Runnable after) {
PitSummary.INSTANCE.waitForPitToFinish();
}

/**
* Runs the runnable (expected to execute PIT) and waits for PIT to finish.
* @param runnable which is executed
*/
public void runAndWaitForPit(Runnable runnable) {
assertNoErrorsInWorkspace();
// reset Summary result
PitSummary.INSTANCE.resetSummary();
// this is expected to run PIT somehow
runnable.run();
// wait for pit to finish
PitSummary.INSTANCE.waitForPitToFinish();
}

public void assertNoErrorsInWorkspace() {
Set<String> errors = errorsInWorkspace();
assertThat(errors, empty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ protected static void runFreeStyleTest(Runnable runnable) throws CoreException {
new PitclipseSteps().runPitAndWaitForIt(runnable);
}

protected static void runAndWaitForPitTest(Runnable runnable) throws CoreException {
new PitclipseSteps().runAndWaitForPit(runnable);
}

/**
* Asserts that the only active mutator was the given mutator.
* @param mutators which should be the only active mutator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,15 @@ public void runPitFromEditorOnNonJavaFile() throws CoreException {
new NoTestsFoundDialog(bot).assertAppears();
}

@Test
public void runWithRunToolbarButton() throws CoreException {
removeMethods(FOO_CLASS, FOO_BAR_PACKAGE, TEST_PROJECT);
removeMethods(FOO_TEST_CLASS, FOO_BAR_PACKAGE, TEST_PROJECT);
PAGES.getPackageExplorer().selectClass(FOO_TEST_CLASS, FOO_BAR_PACKAGE, TEST_PROJECT);
runAndWaitForPitTest(() ->
bot.toolbarDropDownButtonWithTooltip("Run").click()
);
mutationsAre(Collections.emptyList());
noCoverageReportGenerated();
}
}

0 comments on commit 777b2c9

Please sign in to comment.