Skip to content

Commit

Permalink
us #1207024 : [TeamCity] Support Gherkin test result publishing in Te…
Browse files Browse the repository at this point in the history
…amCity
  • Loading branch information
Radislav Berkovich committed Apr 20, 2021
1 parent 7cd23a1 commit 4491af9
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import jetbrains.buildServer.util.ExceptionUtil;
import jetbrains.buildServer.web.openapi.PluginDescriptor;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;

import java.io.DataInputStream;
Expand Down Expand Up @@ -312,13 +313,21 @@ private List<TestRun> createTestList(SFinishedBuild build) {
testResultStatus = TestRunResult.PASSED;
}
TestName fqTestName = testRun.getTest().getName();
String pkgName = fqTestName.getPackageName();
String className = fqTestName.getClassName();
String testName = fqTestName.getTestMethodName();
if (pkgName.length() > MAX_SIZE ||
className.length() > MAX_SIZE ||
testName.length() > MAX_SIZE) {
log.error("Test [" + fqTestName.toString() + "] excluded from test results sending to ALM Octane. One of its parameters (package name, class name or test name) exceeds max size of 255 chars length.");
String pkgName, className, testName;
if (fqTestName.isJavaLikeTestName()) {
pkgName = fqTestName.getPackageName();
className = fqTestName.getClassName();
testName = fqTestName.getTestMethodName();
} else {
pkgName = StringUtils.strip(fqTestName.getSuite(), ": ");
className = null;
testName = fqTestName.getNameWithoutSuite();
}

if ((pkgName != null && pkgName.length() > MAX_SIZE) ||
(className != null && className.length() > MAX_SIZE) ||
(testName != null && testName.length() > MAX_SIZE)) {
log.error("Test [" + fqTestName + "] excluded from test results sending to ALM Octane. One of its parameters (package name, class name or test name) exceeds max size of 255 chars length.");
} else {
TestRun tr = dtoFactory.newDTO(TestRun.class)
.setModuleName("")
Expand Down

0 comments on commit 4491af9

Please sign in to comment.