/** * save action * * <p>Update TestCase result based on test step results * * @throws UCMException */ public void save() throws UCMException { try { this.testCase.setModifiedBy(authUser.getUsername()); for (TestCaseStep tcs : this.testCase.getTestCaseSteps()) { if (tcs.getTestResultType() != null) { this.testCase.setTestResultType(TestResultType.Passed); if (tcs.getTestResultType().equals(TestResultType.Failed)) { this.testCase.setTestResultType(TestResultType.Failed); break; } } else { this.testCase.setTestResultType(TestResultType.Unknown); } } Timestamp now = new Timestamp(System.currentTimeMillis()); this.testCase.setTestDate(now); em.persist(this.testCase); logger.info("saved: {}", this.testCase.getArtifact()); this.facesContextMessage.infoMessage("{0} saved successfully", this.testCase.getArtifact()); } catch (Exception e) { throw new UCMException(e); } }
public int compare(TestCaseStep f1, TestCaseStep f2) { return f1.getStepNumber().compareTo(f2.getStepNumber()); }