1+ /*
2+ * The MIT License
3+ *
4+ * Copyright (c) 2010-2016 Bruno P. Kinoshita
5+ *
6+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7+ * of this software and associated documentation files (the "Software"), to deal
8+ * in the Software without restriction, including without limitation the rights
9+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ * copies of the Software, and to permit persons to whom the Software is
11+ * furnished to do so, subject to the following conditions:
12+ *
13+ * The above copyright notice and this permission notice shall be included in
14+ * all copies or substantial portions of the Software.
15+ *
16+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+ */
120package org .tap4j .plugin ;
221
22+ import hudson .model .Result ;
323import org .junit .Rule ;
424import org .junit .Test ;
525import org .jvnet .hudson .test .JenkinsRule ;
626import org .jenkinsci .plugins .workflow .job .WorkflowJob ;
27+ import org .jenkinsci .plugins .workflow .job .WorkflowRun ;
728import org .jenkinsci .plugins .workflow .cps .CpsFlowDefinition ;
829
930public class TapPublisherPipelineTest {
@@ -12,13 +33,22 @@ public class TapPublisherPipelineTest {
1233 public JenkinsRule j = new JenkinsRule ();
1334
1435 @ Test
15- public void publishTapSymbolWorks () throws Exception {
36+ public void publishTapSymbolWorksWithValidTapFile () throws Exception {
37+
1638 WorkflowJob job = j .createProject (WorkflowJob .class );
1739
1840 job .setDefinition (new CpsFlowDefinition (
19- "publishTap(testResults: 'test.log')" ,
20- true ));
41+ "node {\n " +
42+ " writeFile file: 'test.log', text: '1..1\\ nok 1 - Sample test\\ n'\n " +
43+ " publishTap(testResults: 'test.log')\n " +
44+ "}" ,
45+ true
46+ ));
47+
48+ WorkflowRun run = j .buildAndAssertSuccess (job );
2149
22- j .buildAndAssertSuccess (job );
50+ j .assertBuildStatus (Result .SUCCESS , run );
51+ j .assertLogContains ("TAP Reports Processing: START" , run );
52+ j .assertLogContains ("TAP Reports Processing: FINISH" , run );
2353 }
2454}
0 commit comments