|
48 | 48 | import static java.util.Collections.emptyList;
|
49 | 49 | import static java.util.stream.Collectors.joining;
|
50 | 50 |
|
| 51 | +/** |
| 52 | + * Outputs Teamcity services messages to std out. |
| 53 | + * |
| 54 | + * @see <a |
| 55 | + * href=https://www.jetbrains.com/help/teamcity/service-messages.html>TeamCity |
| 56 | + * - Service Messages</a> |
| 57 | + */ |
51 | 58 | public class TeamCityPlugin implements EventListener {
|
52 | 59 |
|
53 | 60 | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'hh:mm:ss.SSSZ");
|
@@ -250,22 +257,27 @@ private void printTestStepFinished(TestStepFinished event) {
|
250 | 257 | Throwable error = event.getResult().getError();
|
251 | 258 | Status status = event.getResult().getStatus();
|
252 | 259 | switch (status) {
|
253 |
| - case SKIPPED: |
254 |
| - print(TEMPLATE_TEST_IGNORED, timeStamp, duration, error == null ? "Step skipped" : error.getMessage(), |
255 |
| - name); |
| 260 | + case SKIPPED: { |
| 261 | + String message = error == null ? "Step skipped" : error.getMessage(); |
| 262 | + print(TEMPLATE_TEST_IGNORED, timeStamp, duration, message, name); |
256 | 263 | break;
|
257 |
| - case PENDING: |
258 |
| - print(TEMPLATE_TEST_IGNORED, timeStamp, duration, error == null ? "Step pending" : error.getMessage(), |
259 |
| - name); |
| 264 | + } |
| 265 | + case PENDING: { |
| 266 | + String details = error == null ? "" : error.getMessage(); |
| 267 | + print(TEMPLATE_TEST_FAILED, timeStamp, duration, "Step pending", details, name); |
260 | 268 | break;
|
261 |
| - case UNDEFINED: |
262 |
| - print(TEMPLATE_TEST_FAILED, timeStamp, duration, "Step undefined", getSnippets(currentTestCase), name); |
| 269 | + } |
| 270 | + case UNDEFINED: { |
| 271 | + String snippets = getSnippets(currentTestCase); |
| 272 | + print(TEMPLATE_TEST_FAILED, timeStamp, duration, "Step undefined", snippets, name); |
263 | 273 | break;
|
| 274 | + } |
264 | 275 | case AMBIGUOUS:
|
265 |
| - case FAILED: |
| 276 | + case FAILED: { |
266 | 277 | String details = extractStackTrace(error);
|
267 | 278 | print(TEMPLATE_TEST_FAILED, timeStamp, duration, "Step failed", details, name);
|
268 | 279 | break;
|
| 280 | + } |
269 | 281 | default:
|
270 | 282 | break;
|
271 | 283 | }
|
|
0 commit comments