Skip to content

Commit

Permalink
Added extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Mayer committed Aug 6, 2020
1 parent 08ab346 commit 0cdc9a6
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.github.letsrokk.tm4j.client.TM4JClientFactory;
import com.github.letsrokk.tm4j.client.model.Execution;
import com.github.letsrokk.tm4j.client.model.ExecutionStatus;
import com.github.letsrokk.tm4j.client.model.TestRun;
import com.github.letsrokk.tm4j.testng.container.CustomExecutionContainer;
import com.github.letsrokk.tm4j.testng.container.CustomExecutionException;
import com.github.letsrokk.tm4j.testng.container.CustomSuiteContainer;
Expand Down Expand Up @@ -77,9 +78,19 @@ private void initSuiteContainer(String projectKey, String suiteName) {
.name(suiteName)
.build();

String testRunKey = tm4jClient.getTestRunByProjectKeyAndName(projectKey, suiteName)
.orElseGet(() -> tm4jClient.createTestRun(suiteContainer.getProjectKey(), suiteContainer.getName()))
.getKey();
log.debug("Searcing project {} for test cycle \"{}\"", projectKey, suiteName);

Optional<TestRun> testRun = tm4jClient.getTestRunByProjectKeyAndName(projectKey, suiteName);
String testRunKey;
if (testRun.isPresent()) {
log.debug("Test Cycle found: {} {}", testRun.get().getKey(), testRun.get().getName());
testRunKey = testRun.get().getKey();
} else {
log.debug("Test Cycle was not found. Creating new Test Cycle");
TestRun newTestRun = tm4jClient.createTestRun(suiteContainer.getProjectKey(), suiteContainer.getName());
log.debug("Test Cycle created: {} {}", newTestRun.getKey(), newTestRun.getName());
testRunKey = newTestRun.getKey();
}

suiteContainer.setTestRunKey(testRunKey);
} else {
Expand Down

0 comments on commit 0cdc9a6

Please sign in to comment.