Skip to content
Permalink
Browse files
[FIXED JENKINS-24843] Copy duration from Tabulated Tests
  • Loading branch information
kinow committed Oct 9, 2015
1 parent 826be90 commit 96365ab5f1d3eabc2c34e436dfa5ce826d6cfcbb
Showing with 16 additions and 5 deletions.
  1. +15 −5 src/main/java/org/tap4j/plugin/TapResult.java
  2. +1 −0 src/main/java/org/tap4j/plugin/model/TapTestResultResult.java
@@ -23,10 +23,6 @@
*/
package org.tap4j.plugin;

import hudson.FilePath;
import hudson.model.ModelObject;
import hudson.model.AbstractBuild;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
@@ -59,6 +55,10 @@
import org.tap4j.util.DirectiveValues;
import org.tap4j.util.StatusValues;

import hudson.FilePath;
import hudson.model.AbstractBuild;
import hudson.model.ModelObject;

/**
* @author Bruno P. Kinoshita - http://www.kinoshita.eti.br
* @since 1.0
@@ -68,6 +68,8 @@ public class TapResult implements ModelObject, Serializable {
private static final long serialVersionUID = 4343399327336076951L;

private static final Logger LOGGER = Logger.getLogger(TapResult.class.getName());

private static final String DURATION_KEY = "duration_ms";

private AbstractBuild<?, ?> build;
private List<TestSetMap> testSets;
@@ -183,7 +185,15 @@ public void tally() {
} else {
passed += 1;
}
duration += 0.0f; // FIXME add code to tally duration
// FIXME: code duplication. Refactor it and TapTestResultResult
Map<String, Object> diagnostic = testResult.getDiagnostic();
if (diagnostic != null && ! diagnostic.isEmpty()) {
Object duration = diagnostic.get(DURATION_KEY);
if (duration != null) {
Float durationMS = Float.parseFloat(duration.toString());
this.duration += durationMS;
}
}
}
}

@@ -262,6 +262,7 @@ public String getTitle() {

public float getDuration() {
Map<String, Object> diagnostic = this.tapTestResult.getDiagnostic();
// FIXME: code duplication. Refactor it and TapResult
if (diagnostic != null && ! diagnostic.isEmpty()) {
Object duration = diagnostic.get(DURATION_KEY);
if (duration != null) {

0 comments on commit 96365ab

Please sign in to comment.