forked from kinow/tap-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-16647] Added column for duration ms in test results UI
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/test/java/org/tap4j/plugin/issue16647/TestIssue16647.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.tap4j.plugin.issue16647; | ||
|
||
import hudson.Launcher; | ||
import hudson.model.BuildListener; | ||
import hudson.model.FreeStyleBuild; | ||
import hudson.model.AbstractBuild; | ||
import hudson.model.FreeStyleProject; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
import org.jvnet.hudson.test.HudsonTestCase; | ||
import org.jvnet.hudson.test.TestBuilder; | ||
import org.tap4j.plugin.TapPublisher; | ||
import org.tap4j.plugin.TapTestResultAction; | ||
import org.tap4j.plugin.model.TapStreamResult; | ||
import org.tap4j.plugin.model.TapTestResultResult; | ||
|
||
public class TestIssue16647 extends HudsonTestCase { | ||
|
||
public void testDurationMs() throws IOException, InterruptedException, ExecutionException { | ||
FreeStyleProject project = this.hudson.createProject(FreeStyleProject.class, "tap-bug-16647"); | ||
|
||
final String tap = "1..2\n" + | ||
"ok 1 - Input file opened\n" + | ||
"not ok 2 - First line of the input valid\n" + | ||
" ---\n" + | ||
" duration_ms: 100.66\n" + | ||
" ...\n"; | ||
|
||
project.getBuildersList().add(new TestBuilder() { | ||
@Override | ||
public boolean perform(AbstractBuild<?, ?> build, Launcher arg1, | ||
BuildListener arg2) throws InterruptedException, IOException { | ||
build.getWorkspace().child("result.tap").write(tap,"UTF-8"); | ||
return true; | ||
} | ||
}); | ||
|
||
TapPublisher publisher = new TapPublisher( | ||
"result.tap", | ||
true, | ||
true, | ||
true, | ||
true, | ||
true, | ||
true); | ||
project.getPublishersList().add(publisher); | ||
project.save(); | ||
FreeStyleBuild build = (FreeStyleBuild) project.scheduleBuild2(0).get(); | ||
|
||
TapTestResultAction action = build.getAction(TapTestResultAction.class); | ||
TapStreamResult result = (TapStreamResult) action.getResult(); | ||
|
||
TapTestResultResult[] results = result.getChildren().toArray(new TapTestResultResult[0]); | ||
assertEquals(100.66f, results[1].getDuration()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Tests for issue JENKINS-16647. | ||
*/ | ||
package org.tap4j.plugin.issue16647; |