-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from Amaralus/exec-runtime-2
Exec runtime
- Loading branch information
Showing
24 changed files
with
277 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 32 additions & 12 deletions
44
src/main/java/apps/amaralus/qa/platform/runtime/ExecutableTestPlan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,55 @@ | ||
package apps.amaralus.qa.platform.runtime; | ||
|
||
import apps.amaralus.qa.platform.runtime.execution.Cancelable; | ||
import apps.amaralus.qa.platform.runtime.execution.Executable; | ||
import apps.amaralus.qa.platform.runtime.execution.ExecutionGraph; | ||
import lombok.RequiredArgsConstructor; | ||
import apps.amaralus.qa.platform.runtime.execution.ExecutionGraphDelegate; | ||
import apps.amaralus.qa.platform.runtime.report.ReportSupplier; | ||
import apps.amaralus.qa.platform.runtime.report.TestReport; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
@RequiredArgsConstructor | ||
public class ExecutableTestPlan implements Executable, Cancelable { | ||
import static apps.amaralus.qa.platform.runtime.TestState.*; | ||
|
||
private final ExecutionGraph executionGraph; | ||
private final List<ExecutableTestCase> testCases; | ||
private final AtomicBoolean canceled = new AtomicBoolean(); | ||
public class ExecutableTestPlan extends ExecutableTestSupport implements ExecutionGraphDelegate { | ||
@Setter | ||
private ExecutionGraph executionGraph; | ||
|
||
public ExecutableTestPlan(TestInfo testInfo) { | ||
super(testInfo); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
if (isCanceled()) | ||
return; | ||
|
||
timer.start(); | ||
setState(RUNNING); | ||
executionGraph.execute(); | ||
} | ||
|
||
@Override | ||
public void cancel() { | ||
canceled.set(true); | ||
super.cancel(); | ||
setState(CANCELED); | ||
executionGraph.cancel(); | ||
} | ||
|
||
@Override | ||
public boolean isCanceled() { | ||
return canceled.get(); | ||
public void executionGraphFinishedCallback() { | ||
setState(COMPLETED); | ||
} | ||
|
||
public List<ExecutableTestCase> getTestCases() { | ||
return executionGraph.getTasks(ExecutableTestCase.class); | ||
} | ||
|
||
@Override | ||
public TestReport getReport() { | ||
var report = super.getReport(); | ||
report.setSubReports(getTestCases().stream() | ||
.map(ReportSupplier::getReport) | ||
.toList()); | ||
return report; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/apps/amaralus/qa/platform/runtime/ExecutableTestSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package apps.amaralus.qa.platform.runtime; | ||
|
||
import apps.amaralus.qa.platform.runtime.execution.Cancelable; | ||
import apps.amaralus.qa.platform.runtime.execution.Executable; | ||
import apps.amaralus.qa.platform.runtime.report.ReportSupplier; | ||
import apps.amaralus.qa.platform.runtime.report.TestReport; | ||
import apps.amaralus.qa.platform.runtime.report.Timer; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
import static apps.amaralus.qa.platform.runtime.TestState.CREATED; | ||
|
||
@RequiredArgsConstructor | ||
public abstract class ExecutableTestSupport implements Executable, Cancelable, ReportSupplier { | ||
@Getter | ||
protected final TestInfo testInfo; | ||
protected final Timer timer = new Timer(); | ||
protected final AtomicBoolean canceled = new AtomicBoolean(); | ||
@Getter | ||
protected String resultMessage = ""; | ||
@Setter | ||
@Getter | ||
protected TestState state = CREATED; | ||
|
||
@Override | ||
public void cancel() { | ||
canceled.set(true); | ||
} | ||
|
||
@Override | ||
public boolean isCanceled() { | ||
return canceled.get(); | ||
} | ||
|
||
@Override | ||
public TestReport getReport() { | ||
return new TestReport(testInfo, state, resultMessage, timer.getElapsedAsLocalTime()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.