use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooks method skipTestsWithOpenIssues.
/**
* This hook skips tests that have open github and ENTESB jira issues
* <p>
* Only runs when {@link TestConfiguration#SKIP_TESTS_WITH_OPEN_ISSUES} property is set to true
*
* @param scenario scenario
*/
@Before
public void skipTestsWithOpenIssues(Scenario scenario) {
if (TestConfiguration.skipTestsWithOpenIssues()) {
log.info(scenario.getName());
if (scenario.getSourceTagNames().contains("@notIgnoreOpenIssue")) {
return;
}
List<SimpleIssue> issues = getAllIssues(scenario);
for (SimpleIssue issue : issues) {
// assumeFalse will skip the test if the argument evaluates to true, i.e. when the issue is open
Assumptions.assumeThat(issue.getState()).isNotEqualTo(IssueState.OPEN);
}
}
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooks method logIssues.
private static void logIssues(Scenario scenario, List<SimpleIssue> issues) {
for (SimpleIssue issue : issues) {
IssueHooksUtils.logError(scenario, "#### Title: " + issue.getIssueSummary());
IssueHooksUtils.logError(scenario, "#### Link: " + issue.getUrl());
IssueHooksUtils.logError(scenario, "----------------------------------------");
}
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class IssueHooks method checkIssues.
/**
* This hook checks and reports status of linked github and ENTESB Jira issues.
* <p>
* Each failed scenario is checked if it contains a tag in the form @gh-<issue-number> or @ENTESB-<issue-number>.
* If it does, Jira or GitHub and ZenHub are queried for the status of each issue and a summary is written into log and cucumber report.
* <p>
* For the purposes of this report, the following issue states are recognized:
* <ol>
* <li>Open - an issue that was reported and not yet fixed</li>
* <li>Done - an issue that was reported and supposedly fixed</li>
* <li>Closed - and issue that was fixed and verified by QE</li>
* </ol>
* <p>
* <p>
* No effort is made to reason about the impact of the found issues (e.g. is it ok that a test fails if there's one open and one done issue?).
* Also, this hook completely ignores passed tests (i.e. nothing happens when a tests with open issues passes).
*
* @param scenario scenario
*/
@After
public void checkIssues(Scenario scenario) {
if (!scenario.isFailed()) {
return;
}
List<SimpleIssue> issues = getAllIssues(scenario);
if (issues.isEmpty()) {
IssueHooksUtils.logError(scenario, "############ No GitHub or Jira issue annotations found ############");
return;
}
try {
List<SimpleIssue> openIssues = new ArrayList<>();
List<SimpleIssue> doneIssues = new ArrayList<>();
List<SimpleIssue> closedIssues = new ArrayList<>();
for (SimpleIssue issue : issues) {
switch(issue.getState()) {
case DONE:
doneIssues.add(issue);
break;
case OPEN:
openIssues.add(issue);
break;
case CLOSED:
closedIssues.add(issue);
break;
}
}
IssueHooksUtils.logError(scenario, "############ FAILED PROBABLY DUE TO: ################");
IssueHooksUtils.logError(scenario, "######## DONE issues ########");
IssueHooks.logIssues(scenario, doneIssues);
IssueHooksUtils.logError(scenario, "######## CLOSED issues ########");
IssueHooks.logIssues(scenario, closedIssues);
IssueHooksUtils.logError(scenario, "######## OPEN issues ########");
IssueHooks.logIssues(scenario, openIssues);
embedIssues(scenario, issues);
} catch (Exception e) {
log.error("Error while processing GH & Jira issues", e);
scenario.attach("Error while processing GH & Jira issues".getBytes(), "text/plain", "ErrorMessage");
e.printStackTrace();
}
}
use of io.syndesis.qe.issue.SimpleIssue in project syndesis-qe by syndesisio.
the class MailFormatter method reportOpenIssues.
private void reportOpenIssues() {
List<SimpleIssue> allOpenIssues = new ArrayList<>();
results.forEach(scenarioResult -> {
if (scenarioResult.getIssues() != null) {
scenarioResult.getIssues().forEach(issue -> {
if (IssueState.OPEN == issue.getState()) {
allOpenIssues.add(issue);
}
});
}
});
if (allOpenIssues.isEmpty()) {
return;
}
try (FileWriter out = new FileWriter(new File(path, "issues.html"))) {
for (SimpleIssue issue : allOpenIssues) {
out.write(String.format("%s - %s\n", issue.toLink(), issue.getIssueSummary()));
}
} catch (IOException e) {
log.error("Error writing issues report file", e);
}
}
Aggregations