aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/test/ws/TestsShowActionTest/show_from_test_data.json8
-rw-r--r--sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java8
-rw-r--r--sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java2
3 files changed, 5 insertions, 13 deletions
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/test/ws/TestsShowActionTest/show_from_test_data.json b/server/sonar-server/src/test/resources/org/sonar/server/test/ws/TestsShowActionTest/show_from_test_data.json
index f8832a0f01f..97a9239999b 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/test/ws/TestsShowActionTest/show_from_test_data.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/test/ws/TestsShowActionTest/show_from_test_data.json
@@ -1,18 +1,16 @@
{
-"tests": [
+ "tests": [
{
"name": "test1",
"status": "OK",
- "durationInMs": 10,
- "coveredLines": 32
+ "durationInMs": 10
},
{
"name": "test2",
"status": "ERROR",
"durationInMs": 97,
- "coveredLines": 21,
"message": "expected:<true> but was:<false>",
- "stackTrace" : "java.lang.AssertionError: expected:<true> but was:<false>\n\tat org.junit.Assert.fail(Assert.java:91)\n\tat org.junit.Assert.failNotEquals(Assert.java:645)\n\tat org.junit.Assert.assertEquals(Assert.java:126)\n\tat org.junit.Assert.assertEquals(Assert.java:145)\n"
+ "stackTrace": "java.lang.AssertionError: expected:<true> but was:<false>\n\tat org.junit.Assert.fail(Assert.java:91)\n\tat org.junit.Assert.failNotEquals(Assert.java:645)\n\tat org.junit.Assert.assertEquals(Assert.java:126)\n\tat org.junit.Assert.assertEquals(Assert.java:145)\n"
}
]
}
diff --git a/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java b/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
index 117a3b25c54..ca756649a80 100644
--- a/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
+++ b/sonar-server/src/main/java/org/sonar/server/test/ws/TestsShowAction.java
@@ -117,16 +117,12 @@ public class TestsShowAction implements RequestHandler {
json.prop("name", cursor.getAttrValue("name"));
json.prop("status", cursor.getAttrValue("status").toUpperCase());
- json.prop("durationInMs", cursor.getAttrValue("time"));
+ json.prop("durationInMs", Long.parseLong(cursor.getAttrValue("time")));
SMInputCursor errorCursor = cursor.childElementCursor();
if (errorCursor.getNext() != null) {
json.prop("message", errorCursor.getAttrValue("message"));
-
- SMInputCursor stackTraceCursor = cursor.childElementCursor();
- if (stackTraceCursor.getNext() != null) {
-// json.prop("stackTrace", stackTraceCursor.getAttrValue(""));
- }
+ json.prop("stackTrace", errorCursor.getElemStringValue());
}
json.endObject();
diff --git a/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java b/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
index 07f9be4ab61..10f685adede 100644
--- a/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/test/ws/TestsShowActionTest.java
@@ -114,8 +114,6 @@ public class TestsShowActionTest {
"</testcase>" +
"</tests-details>"));
- // TODO failure
-
WsTester.TestRequest request = tester.newGetRequest("api/tests", "show").setParam("key", TEST_PLAN_KEY);
request.execute().assertJson(getClass(), "show_from_test_data.json");