-
Notifications
You must be signed in to change notification settings - Fork 5
Not run/Skipped test reporting #13
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
Open
knekylen-smith
wants to merge
4
commits into
codice:master
Choose a base branch
from
knekylen-smith:NotRunTestReporting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
60 changes: 60 additions & 0 deletions
60
codice-itest-impl/src/main/java/org/codice/itest/ITestExecutorService.java
This file contains hidden or 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,60 @@ | ||
| /** | ||
| * Copyright (c) Codice Foundation | ||
|
|
||
| * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License | ||
| * as published by the Free Software Foundation, either version 3 of the License, or any later version. | ||
|
|
||
| * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at | ||
| * http://www.gnu.org/licenses/lgpl.html. | ||
| */ | ||
| package org.codice.itest; | ||
|
|
||
| import org.codice.itest.api.TestResult; | ||
| import org.codice.itest.api.TestResultFactory; | ||
| import org.codice.itest.config.ITestConfigurationProperties; | ||
| import org.codice.itest.reporter.RemainingTestsReporter; | ||
| import org.springframework.beans.factory.annotation.Value; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.util.List; | ||
| import java.util.concurrent.BlockingQueue; | ||
| import java.util.concurrent.ThreadPoolExecutor; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.function.Consumer; | ||
|
|
||
| @Component("ITestExecutorService") | ||
| public class ITestExecutorService extends ThreadPoolExecutor { | ||
|
|
||
| @Value("${itest.tests:#{null}}") | ||
| private String tests; | ||
|
|
||
| private List<Consumer<TestResult>> testResultListenerList; | ||
| private final ITestConfigurationProperties iTestConfigurationProperties; | ||
|
|
||
| private List<String> testNameList; | ||
|
|
||
| private RemainingTestsReporter remainingTestsReporter; | ||
|
|
||
| private TestResultFactory testResultFactory; | ||
|
|
||
| public ITestExecutorService(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, | ||
| BlockingQueue<Runnable> workQueue, List<Consumer<TestResult>> testResultListenerList, ITestConfigurationProperties iTestConfigurationProperties, RemainingTestsReporter remainingTestsReporter, TestResultFactory testResultFactory) { | ||
| super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); | ||
| this.testResultListenerList = testResultListenerList; | ||
| this.iTestConfigurationProperties = iTestConfigurationProperties; | ||
| this.testNameList = iTestConfigurationProperties.tests(); | ||
| this.remainingTestsReporter = remainingTestsReporter; | ||
| this.testResultFactory = testResultFactory; | ||
| } | ||
|
|
||
| @Override | ||
| public List<Runnable> shutdownNow() { | ||
| remainingTestsReporter.getRemainingList().forEach(testName -> { | ||
| TestResult testResult = testResultFactory.notExecuted(testName); | ||
| testResultListenerList.forEach(listener -> listener.accept(testResult)); | ||
| }); | ||
|
|
||
| return super.shutdownNow(); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
codice-itest-impl/src/main/java/org/codice/itest/reporter/RemainingTestsReporter.java
This file contains hidden or 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,36 @@ | ||
| /** | ||
| * Copyright (c) Codice Foundation | ||
|
|
||
| * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License | ||
| * as published by the Free Software Foundation, either version 3 of the License, or any later version. | ||
|
|
||
| * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at | ||
| * http://www.gnu.org/licenses/lgpl.html. | ||
| */ | ||
| package org.codice.itest.reporter; | ||
|
|
||
| import org.codice.itest.api.TestResult; | ||
|
|
||
| import java.util.List; | ||
| import java.util.function.Consumer; | ||
|
|
||
| public class RemainingTestsReporter implements Consumer<TestResult> { | ||
| private List<String> testNames; | ||
| private List<String> remainingTestNames; | ||
|
|
||
| public RemainingTestsReporter(List<String> testNames){ | ||
| this.testNames = testNames; | ||
| this.remainingTestNames = testNames; | ||
| } | ||
|
|
||
| @Override | ||
| public void accept(TestResult testResult) { | ||
| if(testNames.contains(testResult.getTestName())){ | ||
| remainingTestNames.remove(testResult.getTestName()); | ||
| } | ||
| } | ||
|
|
||
| public List<String> getRemainingList(){return remainingTestNames;} | ||
|
|
||
| } |
This file contains hidden or 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
63 changes: 63 additions & 0 deletions
63
codice-itest-impl/src/main/java/org/codice/itest/result/NotExecutedTestResultImpl.java
This file contains hidden or 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,63 @@ | ||
| /** | ||
| * Copyright (c) Codice Foundation | ||
|
|
||
| * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License | ||
| * as published by the Free Software Foundation, either version 3 of the License, or any later version. | ||
|
|
||
| * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at | ||
| * http://www.gnu.org/licenses/lgpl.html. | ||
| */ | ||
| package org.codice.itest.result; | ||
|
|
||
| import org.apache.commons.lang3.builder.EqualsBuilder; | ||
| import org.apache.commons.lang3.builder.HashCodeBuilder; | ||
|
|
||
| import java.time.Instant; | ||
| import java.util.UUID; | ||
|
|
||
| import static org.codice.itest.api.TestStatus.NOT_EXECUTED; | ||
|
|
||
| final class NotExecutedTestResultImpl extends BaseTestResult{ | ||
|
|
||
| NotExecutedTestResultImpl(UUID runId, String testName) { | ||
| super(runId, testName, NOT_EXECUTED, Instant.now(), Instant.now()); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return toStringCreator.append(super.getRunId()) | ||
| .append(super.getTestStatus()) | ||
| .append(super.getTestName()) | ||
| .append(NOT_EXECUTED) | ||
| .toString(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object other) { | ||
| if (other == null) { | ||
| return false; | ||
| } | ||
|
|
||
| if (other == this) { | ||
| return true; | ||
| } | ||
|
|
||
| if (!(other instanceof NotExecutedTestResultImpl testResult)) { | ||
| return false; | ||
| } | ||
|
|
||
| return new EqualsBuilder().append(super.getRunId(), testResult.getRunId()) | ||
| .append(super.getTestName(), testResult.getTestName()) | ||
| .append(super.getTestStatus(), testResult.getTestStatus()) | ||
| .isEquals(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return new HashCodeBuilder(1313, 4137).append(super.getRunId()) | ||
| .append(super.getTestName()) | ||
| .append(super.getTestStatus()) | ||
| .build(); | ||
| } | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.