aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-10-19 16:50:16 +0200
committerJulien HENRY <henryju@yahoo.fr>2016-10-21 13:17:30 +0200
commit9ddf6fda885838c8a3a12b5ade1cf9a32df95763 (patch)
treeed055e86006645160a9122496ae0c7a2ee3c997a /it
parentf8703a4155668ee958bd38d59776c1415fce0f82 (diff)
downloadsonarqube-9ddf6fda885838c8a3a12b5ade1cf9a32df95763.tar.gz
sonarqube-9ddf6fda885838c8a3a12b5ade1cf9a32df95763.zip
SONAR-8310, SONAR-8314 Make generic coverage plugin a core feature
Diffstat (limited to 'it')
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-details/sonar-project.properties (renamed from it/it-projects/testing/xoo-sample-with-tests-execution/sonar-project.properties)0
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-details/src/main/xoo/sample/Sample.xoo (renamed from it/it-projects/testing/xoo-sample-with-tests-execution/src/main/xoo/sample/Sample.xoo)0
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo (renamed from it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo)0
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo.test (renamed from it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.test)0
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-measures/sonar-project.properties6
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/main/xoo/sample/Sample.xoo12
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo32
-rw-r--r--it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo.measures (renamed from it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.measures)2
-rw-r--r--it/it-tests/src/test/java/it/test/TestExecutionTest.java22
9 files changed, 69 insertions, 5 deletions
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution/sonar-project.properties b/it/it-projects/testing/xoo-sample-with-tests-execution-details/sonar-project.properties
index 0f2415d0320..0f2415d0320 100644
--- a/it/it-projects/testing/xoo-sample-with-tests-execution/sonar-project.properties
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-details/sonar-project.properties
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution/src/main/xoo/sample/Sample.xoo b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/main/xoo/sample/Sample.xoo
index b1210973dd9..b1210973dd9 100644
--- a/it/it-projects/testing/xoo-sample-with-tests-execution/src/main/xoo/sample/Sample.xoo
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/main/xoo/sample/Sample.xoo
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo
index fe2368fefaa..fe2368fefaa 100644
--- a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.test b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo.test
index b0259693199..b0259693199 100644
--- a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.test
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-details/src/test/xoo/sample/SampleTest.xoo.test
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution-measures/sonar-project.properties b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/sonar-project.properties
new file mode 100644
index 00000000000..0f2415d0320
--- /dev/null
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/sonar-project.properties
@@ -0,0 +1,6 @@
+sonar.projectKey=sample-with-tests
+sonar.projectName=Sample with tests
+sonar.projectVersion=1.0-SNAPSHOT
+sonar.sources=src/main/xoo
+sonar.tests=src/test/xoo
+sonar.language=xoo \ No newline at end of file
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/main/xoo/sample/Sample.xoo b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/main/xoo/sample/Sample.xoo
new file mode 100644
index 00000000000..b1210973dd9
--- /dev/null
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/main/xoo/sample/Sample.xoo
@@ -0,0 +1,12 @@
+package sample;
+
+public class Sample {
+
+ public Sample(int i) {
+ int j = i++;
+ }
+
+ private String myMethod() {
+ return "hello";
+ }
+}
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo
new file mode 100644
index 00000000000..fe2368fefaa
--- /dev/null
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo
@@ -0,0 +1,32 @@
+package sample;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+
+import static org.junit.Assert.assertThat;
+
+public class SampleTest {
+
+ @Test
+ @Ignore
+ public void skipped() {
+ Sample sample = new Sample(1);
+ assertThat(sample.getI(), CoreMatchers.is(1));
+ }
+
+ @Test
+ public void failure() {
+ fail();
+ }
+
+ @Test
+ public void error() {
+ throw new IllegalStateException("Foo");
+ }
+
+ @Test
+ public void success() {
+ System.out.println("OK");
+ }
+
+}
diff --git a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.measures b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo.measures
index 095af4b5e7b..de1549480b5 100644
--- a/it/it-projects/testing/xoo-sample-with-tests-execution/src/test/xoo/sample/SampleTest.xoo.measures
+++ b/it/it-projects/testing/xoo-sample-with-tests-execution-measures/src/test/xoo/sample/SampleTest.xoo.measures
@@ -1,4 +1,4 @@
-tests:4
+tests:3
test_execution_time:8
skipped_tests:1
test_errors:1
diff --git a/it/it-tests/src/test/java/it/test/TestExecutionTest.java b/it/it-tests/src/test/java/it/test/TestExecutionTest.java
index f0d11de0533..34c75e01a47 100644
--- a/it/it-tests/src/test/java/it/test/TestExecutionTest.java
+++ b/it/it-tests/src/test/java/it/test/TestExecutionTest.java
@@ -44,19 +44,33 @@ public class TestExecutionTest {
}
@Test
- public void test_execution() throws Exception {
- orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-tests-execution")));
+ public void test_execution_details() throws Exception {
+ orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-tests-execution-details")));
Resource project = orchestrator.getServer().getWsClient()
.find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time"));
- assertThat(project.getMeasureValue("test_success_density")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("test_success_density")).isEqualTo(33.3);
assertThat(project.getMeasureIntValue("test_failures")).isEqualTo(1);
assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("tests")).isEqualTo(4);
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(3);
assertThat(project.getMeasureIntValue("skipped_tests")).isEqualTo(1);
assertThat(project.getMeasureIntValue("test_execution_time")).isEqualTo(8);
String json = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/TestExecutionTest/expected.json"), "UTF-8"), json, false);
}
+
+ @Test
+ public void test_execution_measures() throws Exception {
+ orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-tests-execution-measures")));
+
+ Resource project = orchestrator.getServer().getWsClient()
+ .find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time"));
+ assertThat(project.getMeasureValue("test_success_density")).isEqualTo(33.3);
+ assertThat(project.getMeasureIntValue("test_failures")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(3);
+ assertThat(project.getMeasureIntValue("skipped_tests")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("test_execution_time")).isEqualTo(8);
+ }
}