summaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-04-22 23:32:39 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-04-27 15:46:23 +0200
commit2f2eea3fa99f2148171885fb85561b83a7e4e052 (patch)
treecd8ef2f2ebb6a9a75b874d5d79245396fc3aeefa /sonar-plugin-api
parent0d5306a89afda6a6eed06df78c3f732d247a86d6 (diff)
downloadsonarqube-2f2eea3fa99f2148171885fb85561b83a7e4e052.tar.gz
sonarqube-2f2eea3fa99f2148171885fb85561b83a7e4e052.zip
SONAR-6278 Feed tests in compute report
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/test/MutableTestPlan.java8
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/test/TestCase.java11
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/test/TestPlan.java3
3 files changed, 22 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/test/MutableTestPlan.java b/sonar-plugin-api/src/main/java/org/sonar/api/test/MutableTestPlan.java
index 22bccb8d9fb..4659917f0ee 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/test/MutableTestPlan.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/test/MutableTestPlan.java
@@ -23,6 +23,14 @@ import org.sonar.api.component.MutablePerspective;
public interface MutableTestPlan extends TestPlan<MutableTestCase>, MutablePerspective {
+ /**
+ * Add a {@link TestCase} to this test file.
+ * Note that a same physical test (for example in Java a single method annotated with @Test)
+ * can be executed several times (parameterized tests, different test suites, ...). As a result it is perfectly valid to register several
+ * tests with the same name. Anyway in this situation the coverage per test.
+ * @param name
+ * @return
+ */
MutableTestCase addTestCase(String name);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/test/TestCase.java b/sonar-plugin-api/src/main/java/org/sonar/api/test/TestCase.java
index a01fa7ae2de..301d347f9af 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/test/TestCase.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/test/TestCase.java
@@ -19,8 +19,12 @@
*/
package org.sonar.api.test;
+import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+/**
+ * Represents a simple test execution result.
+ */
public interface TestCase {
enum Status {
OK, FAILURE, ERROR, SKIPPED;
@@ -44,16 +48,23 @@ public interface TestCase {
/**
* Duration in milliseconds
*/
+ @CheckForNull
Long durationInMs();
+ /**
+ * @deprecated since 5.2 not used
+ */
+ @Deprecated
String type();
Status status();
String name();
+ @CheckForNull
String message();
+ @CheckForNull
String stackTrace();
TestPlan testPlan();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/test/TestPlan.java b/sonar-plugin-api/src/main/java/org/sonar/api/test/TestPlan.java
index dbb864426f5..74b4291598e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/test/TestPlan.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/test/TestPlan.java
@@ -21,6 +21,9 @@ package org.sonar.api.test;
import org.sonar.api.component.Perspective;
+/**
+ * A {@link TestPlan} is
+ */
public interface TestPlan<T extends TestCase> extends Perspective {
Iterable<T> testCases();