- JOB=MYSQL
- JOB=WEB
- JOB=ITS IT_CATEGORY=issue
- - JOB=ITS IT_CATEGORY=measure
+ - JOB=ITS IT_CATEGORY=analysis
- JOB=ITS IT_CATEGORY=plugins
- JOB=ITS IT_CATEGORY=qualitygate
- - JOB=ITS IT_CATEGORY=testing
- JOB=ITS IT_CATEGORY=ui
- JOB=ITS IT_CATEGORY=updatecenter
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package analysis.suite;
+
+import analysis.suite.measure.CustomMeasuresTest;
+import analysis.suite.measure.MeasureFiltersTest;
+import analysis.suite.measure.TimeMachineTest;
+import analysis.suite.testing.CoverageTest;
+import analysis.suite.testing.CoverageTrackingTest;
+import analysis.suite.testing.NewCoverageTest;
+import analysis.suite.testing.TestExecutionTest;
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import util.ItUtils;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ CustomMeasuresTest.class,
+ MeasureFiltersTest.class,
+ TimeMachineTest.class,
+ CoverageTrackingTest.class,
+ CoverageTest.class,
+ NewCoverageTest.class,
+ TestExecutionTest.class
+})
+public class AnalysisTestSuite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(ItUtils.xooPlugin())
+ .build();
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package analysis.suite.measure;
+
+import analysis.suite.AnalysisTestSuite;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Measure;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class CustomMeasuresTest {
+
+ public static final String PROJECT_KEY = "sample";
+ @ClassRule
+ public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
+
+ @Before
+ public void deleteProjects() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void custom_measures_should_be_integrated_during_project_analysis() {
+ analyzeProject();
+ setBurnedBudget(1200.3);
+ setTeamSize(4);
+
+ assertThat(getMeasure("team_size")).isNull();
+ assertThat(getMeasure("burned_budget")).isNull();
+
+ analyzeProject();
+
+ assertThat(getMeasure("burned_budget").getValue()).isEqualTo(1200.3);
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
+ }
+
+ @Test
+ public void should_update_value() {
+ analyzeProject();
+ setTeamSize(4);
+ analyzeProject();
+ updateTeamSize(15);
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
+ analyzeProject();// the value is available when the project is analyzed again
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(15);
+ }
+
+ @Test
+ public void should_delete_custom_measure() {
+ analyzeProject();
+ setTeamSize(4);
+ analyzeProject();
+ deleteCustomMeasure("team_size");
+ assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);// the value is still available. It will be removed during next analyzed
+
+ analyzeProject();
+ assertThat(getMeasure("team_size")).isNull();
+ }
+
+ private void analyzeProject() {
+ orchestrator.executeBuild(SonarRunner.create(projectDir("measure/xoo-sample")));
+ }
+
+ private void setTeamSize(int i) {
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "team_size", "value", String.valueOf(i));
+ }
+
+ private void updateTeamSize(int i) {
+ String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", "team_size");
+ Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
+ jsonObjectMatcher.find();
+ String customMeasureId = jsonObjectMatcher.group(1);
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/update", "id", customMeasureId, "value", String.valueOf(i));
+ }
+
+ private void setBurnedBudget(double d) {
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "burned_budget", "value", String.valueOf(d));
+ }
+
+ private void deleteCustomMeasure(String metricKey) {
+ String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", metricKey);
+ Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
+ jsonObjectMatcher.find();
+ String customMeasureId = jsonObjectMatcher.group(1);
+ orchestrator.getServer().adminWsClient().post("api/custom_measures/delete", "id", customMeasureId);
+ }
+
+ private Measure getMeasure(String metricKey) {
+ Resource resource = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, metricKey));
+ return resource != null ? resource.getMeasure(metricKey) : null;
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package analysis.suite.measure;
+
+import analysis.suite.AnalysisTestSuite;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.selenium.Selenese;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.SonarClient;
+import org.sonar.wsclient.permissions.PermissionParameters;
+import org.sonar.wsclient.user.UserParameters;
+
+import static util.ItUtils.projectDir;
+
+public class MeasureFiltersTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void scanStruts() {
+ orchestrator.resetData();
+ orchestrator.executeBuild(SonarRunner.create(projectDir("measure/xoo-multi-modules-sample")));
+
+ createUser("user-measure-filters", "User Measure Filters");
+ }
+
+ @AfterClass
+ public static void deleteTestUser() {
+ deactivateUser("user-measure-filters");
+ }
+
+ @Test
+ public void execute_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("execution_of_measure_filters",
+ "/measure/suite/measure_filters/link_from_main_header.html",
+ "/measure/suite/measure_filters/initial_search_form.html",
+ "/measure/suite/measure_filters/search_for_projects.html",
+ "/measure/suite/measure_filters/search_for_files.html",
+ // SONAR-4195
+ "/measure/suite/measure_filters/search-by-key.html",
+ "/measure/suite/measure_filters/search-by-name.html",
+ "/measure/suite/measure_filters/empty_filter.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
+ @Test
+ public void display_measure_filter_as_list() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("display_measure_filter_as_list",
+ "/measure/suite/measure_filters/list_change_columns.html",
+ "/measure/suite/measure_filters/list_delete_column.html",
+ "/measure/suite/measure_filters/list_move_columns.html",
+ "/measure/suite/measure_filters/list_sort_by_descending_name.html",
+ "/measure/suite/measure_filters/list_sort_by_ncloc.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
+ @Test
+ public void share_measure_filters() {
+ // SONAR-4099
+ String user = "user-measures-filter-with-sharing-perm";
+ createUser(user, "User Measure Filters with sharing permission", "shareDashboard");
+
+ try {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("share_measure_filters",
+ // SONAR-4469
+ "/measure/suite/measure_filters/should-unshare-filter-remove-other-filters-favourite.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+
+ } finally {
+ deactivateUser(user);
+ }
+ }
+
+ /**
+ * SONAR-4099
+ */
+ @Test
+ public void should_not_share_filter_when_user_have_no_sharing_permissions() {
+ String user = "user-measures-filter-with-no-share-perm";
+ createUser(user, "User Measure Filters without sharing permission");
+
+ try {
+ orchestrator.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("should_not_share_filter_when_user_have_no_sharing_permissions",
+ "/measure/suite/measure_filters/should-not-share-filter-when-user-have-no-sharing-permissions.html"
+ ).build());
+ } finally {
+ deactivateUser(user);
+ }
+ }
+
+ @Test
+ public void copy_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("copy_measure_filters",
+ "/measure/suite/measure_filters/copy_measure_filter.html",
+ "/measure/suite/measure_filters/copy_uniqueness_of_name.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
+ @Test
+ public void manage_measure_filters() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("manage_measure_filters",
+ "/measure/suite/measure_filters/save_with_special_characters.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
+ @Test
+ public void measure_filter_list_widget() {
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("measure_filter_list_widget",
+ "/measure/suite/measure_filters/list_widget.html",
+ "/measure/suite/measure_filters/list_widget_sort.html",
+ "/measure/suite/measure_filters/list_widget_warning_if_missing_filter.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
+ private static void createUser(String login, String name) {
+ createUser(login, name, null);
+ }
+
+ private static void createUser(String login, String name, String permission) {
+ SonarClient client = orchestrator.getServer().adminWsClient();
+ UserParameters userCreationParameters = UserParameters.create().login(login).name(name).password("password").passwordConfirmation("password");
+ client.userClient().create(userCreationParameters);
+
+ if (permission != null) {
+ client.permissionClient().addPermission(PermissionParameters.create().user(login).permission(permission));
+ }
+ }
+
+ private static void deactivateUser(String user) {
+ orchestrator.getServer().adminWsClient().userClient().deactivate(user);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package analysis.suite.measure;
+
+import analysis.suite.AnalysisTestSuite;
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.BuildResult;
+import com.sonar.orchestrator.build.SonarRunner;
+import com.sonar.orchestrator.locator.FileLocation;
+import java.util.Date;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+import org.sonar.wsclient.services.TimeMachine;
+import org.sonar.wsclient.services.TimeMachineCell;
+import org.sonar.wsclient.services.TimeMachineQuery;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class TimeMachineTest {
+
+ private static final String PROJECT = "sample";
+
+ @ClassRule
+ public static Orchestrator orchestrator = AnalysisTestSuite.ORCHESTRATOR;
+
+ @BeforeClass
+ public static void initialize() {
+ orchestrator.resetData();
+ orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/TimeMachineTest/one-issue-per-line-profile.xml"));
+ orchestrator.getServer().provisionProject("sample", "Sample");
+ orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
+ analyzeProject("measure/xoo-history-v1", "2014-10-19");
+ analyzeProject("measure/xoo-history-v2", "2014-11-13");
+ }
+
+ private static BuildResult analyzeProject(String path, String date) {
+ return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date));
+ }
+
+ @Test
+ public void projectIsAnalyzed() {
+ assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getVersion()).isEqualTo("1.0-SNAPSHOT");
+ assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getDate().getMonth()).isEqualTo(10); // November
+ }
+
+ @Test
+ public void testHistoryOfIssues() {
+ TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "blocker_violations", "critical_violations", "major_violations",
+ "minor_violations", "info_violations");
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+
+ TimeMachineCell cell1 = timemachine.getCells()[0];
+ TimeMachineCell cell2 = timemachine.getCells()[1];
+
+ assertThat(cell1.getDate().getMonth()).isEqualTo(9);
+ assertThat(cell1.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 26L, 0L});
+
+ assertThat(cell2.getDate().getMonth()).isEqualTo(10);
+ assertThat(cell2.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 43L, 0L});
+ }
+
+ @Test
+ public void testHistoryOfMeasures() {
+ TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "lines", "ncloc");
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+
+ TimeMachineCell cell1 = timemachine.getCells()[0];
+ TimeMachineCell cell2 = timemachine.getCells()[1];
+
+ assertThat(cell1.getDate().getMonth()).isEqualTo(9);
+ assertThat(cell1.getValues()).isEqualTo(new Object[] {26L, 24L});
+
+ assertThat(cell2.getDate().getMonth()).isEqualTo(10);
+ assertThat(cell2.getValues()).isEqualTo(new Object[] {43L, 40L});
+ }
+
+ @Test
+ public void unknownMetrics() {
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "notfound"));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+
+ timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines", "notfound"));
+ assertThat(timemachine.getCells().length).isEqualTo(2);
+ for (TimeMachineCell cell : timemachine.getCells()) {
+ assertThat(cell.getValues().length).isEqualTo(1);
+ assertThat(cell.getValues()[0]).isInstanceOf(Long.class);
+ }
+
+ timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+ }
+
+ @Test
+ public void noDataForInterval() {
+ Date now = new Date();
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines").setFrom(now).setTo(now));
+ assertThat(timemachine.getCells().length).isEqualTo(0);
+ }
+
+ @Test
+ public void unknownResource() {
+ TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics("notfound:notfound", "lines"));
+ assertThat(timemachine).isNull();
+ }
+
+ @Test
+ public void test_measure_variations() {
+ Resource project = getProject("files", "ncloc", "violations");
+
+ // period 1 : previous analysis
+ assertThat(project.getPeriod1Mode()).isEqualTo("previous_analysis");
+ assertThat(project.getPeriod1Date()).isNotNull();
+
+ // variations from previous analysis
+ assertThat(project.getMeasure("files").getVariation1()).isEqualTo(1.0);
+ assertThat(project.getMeasure("ncloc").getVariation1()).isEqualTo(16.0);
+ assertThat(project.getMeasure("violations").getVariation1()).isGreaterThan(0.0);
+ }
+
+ /**
+ * SONAR-4962
+ */
+ @Test
+ public void measure_variations_are_only_meaningful_when_includetrends() {
+ String[] metricKeys = {"violations", "new_violations"};
+
+ Resource projectWithTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
+ assertThat(projectWithTrends.getMeasure("violations")).isNotNull();
+ assertThat(projectWithTrends.getMeasure("new_violations")).isNotNull();
+
+ Resource projectWithoutTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(false));
+ assertThat(projectWithoutTrends.getMeasure("violations")).isNotNull();
+ assertThat(projectWithoutTrends.getMeasure("new_violations")).isNull();
+ }
+
+ private Resource getProject(String... metricKeys) {
+ return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package analysis.suite.testing;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import java.io.File;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class CoverageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = ORCHESTRATOR;
+
+ private static final String[] ALL_COVERAGE_METRICS = new String[] {
+ "line_coverage", "lines_to_cover", "uncovered_lines", "branch_coverage", "conditions_to_cover", "uncovered_conditions", "coverage",
+ "it_line_coverage", "it_lines_to_cover", "it_uncovered_lines", "it_branch_coverage", "it_conditions_to_cover", "it_uncovered_conditions", "it_coverage",
+ "overall_line_coverage", "overall_lines_to_cover", "overall_uncovered_lines", "overall_branch_coverage", "overall_conditions_to_cover", "overall_uncovered_conditions",
+ "overall_coverage"
+ };
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void unit_test_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(2);
+ assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(1);
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("it_coverage")).isNull();
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/unit_test_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void unit_test_coverage_no_condition() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isNull();
+ assertThat(project.getMeasureValue("conditions_to_cover")).isNull();
+ assertThat(project.getMeasureValue("uncovered_conditions")).isNull();
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("it_coverage")).isNull();
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/unit_test_coverage_no_condition-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void it_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isNull();
+
+ assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(1);
+ assertThat(project.getMeasureValue("it_coverage")).isEqualTo(50.0);
+
+ assertThat(project.getMeasureValue("overall_coverage")).isNull();
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-it-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/it_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ @Test
+ public void ut_and_it_coverage() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(25.0);
+ assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(3);
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(37.5);
+
+ assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
+ assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(25.0);
+ assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(3);
+ assertThat(project.getMeasureValue("it_coverage")).isEqualTo(37.5);
+
+ assertThat(project.getMeasureValue("overall_line_coverage")).isEqualTo(75.0);
+ assertThat(project.getMeasureValue("overall_lines_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("overall_uncovered_lines")).isEqualTo(1);
+ assertThat(project.getMeasureValue("overall_branch_coverage")).isEqualTo(50.0);
+ assertThat(project.getMeasureValue("overall_conditions_to_cover")).isEqualTo(4);
+ assertThat(project.getMeasureValue("overall_uncovered_conditions")).isEqualTo(2);
+ assertThat(project.getMeasureValue("overall_coverage")).isEqualTo(62.5);
+
+ String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-overall-coverage:src/main/xoo/sample/Sample.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTest/ut_and_it_coverage-expected.json"), "UTF-8"), coverage, false);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_compute_coverage_on_project() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_ignore_coverage_on_full_path() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_ignore_coverage_on_pattern() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "**/UnCovered*"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ /**
+ * SONAR-766
+ */
+ @Test
+ public void should_not_have_coverage_at_all() {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
+ .setProperty("sonar.coverage.exclusions", "**/*"));
+
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
+ assertThat(project.getMeasureValue("coverage")).isNull();
+
+ verifyComputeEngineTempDirIsEmpty();
+ }
+
+ private void verifyComputeEngineTempDirIsEmpty() {
+ File ceTempDirectory = new File(new File(orchestrator.getServer().getHome(), "temp"), "ce");
+ assertThat(FileUtils.listFiles(ceTempDirectory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)).isEmpty();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package analysis.suite.testing;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
+import static util.ItUtils.projectDir;
+
+public class CoverageTrackingTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = ORCHESTRATOR;
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void test_coverage_per_test() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test")));
+
+ String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false);
+
+ String covered_files = orchestrator.getServer().adminWsClient()
+ .get("api/tests/covered_files", "testUuid", extractSuccessfulTestUuid(tests));
+ JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/testing/suite/CoverageTrackingTest/covered_files-expected.json"), "UTF-8"), covered_files, false);
+ }
+
+ private String extractSuccessfulTestUuid(String json) {
+ Matcher jsonObjectMatcher = Pattern.compile(".*\\{((.*?)success(.*?))\\}.*", Pattern.MULTILINE).matcher(json);
+ jsonObjectMatcher.find();
+
+ Matcher uuidMatcher = Pattern.compile(".*\"testUuid\"\\s*?:\\s*?\"(\\S*?)\".*", Pattern.MULTILINE).matcher(jsonObjectMatcher.group(1));
+ return uuidMatcher.find() ? uuidMatcher.group(1) : "";
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package analysis.suite.testing;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import org.assertj.core.data.Offset;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class NewCoverageTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = ORCHESTRATOR;
+
+ private static final String PROJECT_KEY = "sample-new-coverage";
+
+ private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
+
+ private static final String[] ALL_NEW_COVERAGE_METRICS = new String[] {
+ "new_coverage", "new_line_coverage", "new_branch_coverage",
+ "new_it_coverage", "new_it_line_coverage", "new_it_branch_coverage",
+ "new_overall_coverage", "new_overall_line_coverage", "new_overall_branch_coverage"
+ };
+
+ @BeforeClass
+ public static void analyze_project() {
+ orchestrator.resetData();
+
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1"))
+ .setProperty("sonar.projectDate", "2015-02-01")
+ .setProperty("sonar.scm.disabled", "false")
+ );
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2"))
+ .setProperty("sonar.scm.disabled", "false"));
+ }
+
+ @Test
+ public void new_unit_test_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_coverage").getVariation1()).isEqualTo(62.5d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_line_coverage").getVariation1()).isEqualTo(80d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_branch_coverage").getVariation1()).isEqualTo(33.3, DEFAULT_OFFSET);
+ }
+
+ @Test
+ public void new_integration_test_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_it_coverage").getVariation1()).isEqualTo(85.7, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_it_line_coverage").getVariation1()).isEqualTo(100d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_it_branch_coverage").getVariation1()).isEqualTo(66.7, DEFAULT_OFFSET);
+ }
+
+ @Test
+ public void new_overall_coverage() throws Exception {
+ Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
+ assertThat(project.getMeasure("new_overall_coverage").getVariation1()).isEqualTo(44.4d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_overall_line_coverage").getVariation1()).isEqualTo(50d, DEFAULT_OFFSET);
+ assertThat(project.getMeasure("new_overall_branch_coverage").getVariation1()).isEqualTo(42.85, DEFAULT_OFFSET);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2009-2014 SonarSource SA
+ * All rights reserved
+ * mailto:contact AT sonarsource DOT com
+ */
+package analysis.suite.testing;
+
+import com.sonar.orchestrator.Orchestrator;
+import com.sonar.orchestrator.build.SonarRunner;
+import org.apache.commons.io.IOUtils;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceQuery;
+
+import static analysis.suite.AnalysisTestSuite.ORCHESTRATOR;
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.projectDir;
+
+public class TestExecutionTest {
+
+ @ClassRule
+ public static Orchestrator orchestrator = ORCHESTRATOR;
+
+ @Before
+ public void delete_data() {
+ orchestrator.resetData();
+ }
+
+ @Test
+ public void test_execution() throws Exception {
+ orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution")));
+
+ 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.getMeasureIntValue("test_failures")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
+ assertThat(project.getMeasureIntValue("tests")).isEqualTo(4);
+ 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("/testing/suite/TestExecutionTest/expected.json"), "UTF-8"), json, false);
+ }
+}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package measure.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Measure;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class CustomMeasuresTest {
-
- public static final String PROJECT_KEY = "sample";
- @ClassRule
- public static Orchestrator orchestrator = MeasuresTestSuite.ORCHESTRATOR;
-
- @Before
- public void deleteProjects() {
- orchestrator.resetData();
- }
-
- @Test
- public void custom_measures_should_be_integrated_during_project_analysis() {
- analyzeProject();
- setBurnedBudget(1200.3);
- setTeamSize(4);
-
- assertThat(getMeasure("team_size")).isNull();
- assertThat(getMeasure("burned_budget")).isNull();
-
- analyzeProject();
-
- assertThat(getMeasure("burned_budget").getValue()).isEqualTo(1200.3);
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
- }
-
- @Test
- public void should_update_value() {
- analyzeProject();
- setTeamSize(4);
- analyzeProject();
- updateTeamSize(15);
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);
- analyzeProject();// the value is available when the project is analyzed again
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(15);
- }
-
- @Test
- public void should_delete_custom_measure() {
- analyzeProject();
- setTeamSize(4);
- analyzeProject();
- deleteCustomMeasure("team_size");
- assertThat(getMeasure("team_size").getIntValue()).isEqualTo(4);// the value is still available. It will be removed during next analyzed
-
- analyzeProject();
- assertThat(getMeasure("team_size")).isNull();
- }
-
- private void analyzeProject() {
- orchestrator.executeBuild(SonarRunner.create(projectDir("measure/xoo-sample")));
- }
-
- private void setTeamSize(int i) {
- orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "team_size", "value", String.valueOf(i));
- }
-
- private void updateTeamSize(int i) {
- String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", "team_size");
- Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
- jsonObjectMatcher.find();
- String customMeasureId = jsonObjectMatcher.group(1);
- orchestrator.getServer().adminWsClient().post("api/custom_measures/update", "id", customMeasureId, "value", String.valueOf(i));
- }
-
- private void setBurnedBudget(double d) {
- orchestrator.getServer().adminWsClient().post("api/custom_measures/create", "projectKey", PROJECT_KEY, "metricKey", "burned_budget", "value", String.valueOf(d));
- }
-
- private void deleteCustomMeasure(String metricKey) {
- String response = orchestrator.getServer().adminWsClient().get("api/custom_measures/search", "projectKey", PROJECT_KEY, "metricKey", metricKey);
- Matcher jsonObjectMatcher = Pattern.compile(".*?\"id\"\\s*:\\s*\"(.*?)\".*", Pattern.MULTILINE).matcher(response);
- jsonObjectMatcher.find();
- String customMeasureId = jsonObjectMatcher.group(1);
- orchestrator.getServer().adminWsClient().post("api/custom_measures/delete", "id", customMeasureId);
- }
-
- private Measure getMeasure(String metricKey) {
- Resource resource = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, metricKey));
- return resource != null ? resource.getMeasure(metricKey) : null;
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package measure.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.selenium.Selenese;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.SonarClient;
-import org.sonar.wsclient.permissions.PermissionParameters;
-import org.sonar.wsclient.user.UserParameters;
-
-import static util.ItUtils.projectDir;
-
-public class MeasureFiltersTest {
-
- @ClassRule
- public static Orchestrator orchestrator = MeasuresTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void scanStruts() {
- orchestrator.resetData();
- orchestrator.executeBuild(SonarRunner.create(projectDir("measure/xoo-multi-modules-sample")));
-
- createUser("user-measure-filters", "User Measure Filters");
- }
-
- @AfterClass
- public static void deleteTestUser() {
- deactivateUser("user-measure-filters");
- }
-
- @Test
- public void execute_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("execution_of_measure_filters",
- "/measure/suite/measure_filters/link_from_main_header.html",
- "/measure/suite/measure_filters/initial_search_form.html",
- "/measure/suite/measure_filters/search_for_projects.html",
- "/measure/suite/measure_filters/search_for_files.html",
- // SONAR-4195
- "/measure/suite/measure_filters/search-by-key.html",
- "/measure/suite/measure_filters/search-by-name.html",
- "/measure/suite/measure_filters/empty_filter.html"
- ).build();
- orchestrator.executeSelenese(selenese);
- }
-
- @Test
- public void display_measure_filter_as_list() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("display_measure_filter_as_list",
- "/measure/suite/measure_filters/list_change_columns.html",
- "/measure/suite/measure_filters/list_delete_column.html",
- "/measure/suite/measure_filters/list_move_columns.html",
- "/measure/suite/measure_filters/list_sort_by_descending_name.html",
- "/measure/suite/measure_filters/list_sort_by_ncloc.html"
- ).build();
- orchestrator.executeSelenese(selenese);
- }
-
- @Test
- public void share_measure_filters() {
- // SONAR-4099
- String user = "user-measures-filter-with-sharing-perm";
- createUser(user, "User Measure Filters with sharing permission", "shareDashboard");
-
- try {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("share_measure_filters",
- // SONAR-4469
- "/measure/suite/measure_filters/should-unshare-filter-remove-other-filters-favourite.html"
- ).build();
- orchestrator.executeSelenese(selenese);
-
- } finally {
- deactivateUser(user);
- }
- }
-
- /**
- * SONAR-4099
- */
- @Test
- public void should_not_share_filter_when_user_have_no_sharing_permissions() {
- String user = "user-measures-filter-with-no-share-perm";
- createUser(user, "User Measure Filters without sharing permission");
-
- try {
- orchestrator.executeSelenese(Selenese.builder().setHtmlTestsInClasspath("should_not_share_filter_when_user_have_no_sharing_permissions",
- "/measure/suite/measure_filters/should-not-share-filter-when-user-have-no-sharing-permissions.html"
- ).build());
- } finally {
- deactivateUser(user);
- }
- }
-
- @Test
- public void copy_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("copy_measure_filters",
- "/measure/suite/measure_filters/copy_measure_filter.html",
- "/measure/suite/measure_filters/copy_uniqueness_of_name.html"
- ).build();
- orchestrator.executeSelenese(selenese);
- }
-
- @Test
- public void manage_measure_filters() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("manage_measure_filters",
- "/measure/suite/measure_filters/save_with_special_characters.html"
- ).build();
- orchestrator.executeSelenese(selenese);
- }
-
- @Test
- public void measure_filter_list_widget() {
- Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("measure_filter_list_widget",
- "/measure/suite/measure_filters/list_widget.html",
- "/measure/suite/measure_filters/list_widget_sort.html",
- "/measure/suite/measure_filters/list_widget_warning_if_missing_filter.html"
- ).build();
- orchestrator.executeSelenese(selenese);
- }
-
- private static void createUser(String login, String name) {
- createUser(login, name, null);
- }
-
- private static void createUser(String login, String name, String permission) {
- SonarClient client = orchestrator.getServer().adminWsClient();
- UserParameters userCreationParameters = UserParameters.create().login(login).name(name).password("password").passwordConfirmation("password");
- client.userClient().create(userCreationParameters);
-
- if (permission != null) {
- client.permissionClient().addPermission(PermissionParameters.create().user(login).permission(permission));
- }
- }
-
- private static void deactivateUser(String user) {
- orchestrator.getServer().adminWsClient().userClient().deactivate(user);
- }
-
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package measure.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({CustomMeasuresTest.class, MeasureFiltersTest.class, TimeMachineTest.class})
-public class MeasuresTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
- .build();
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package measure.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.BuildResult;
-import com.sonar.orchestrator.build.SonarRunner;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.util.Date;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-import org.sonar.wsclient.services.TimeMachine;
-import org.sonar.wsclient.services.TimeMachineCell;
-import org.sonar.wsclient.services.TimeMachineQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class TimeMachineTest {
-
- private static final String PROJECT = "sample";
-
- @ClassRule
- public static Orchestrator orchestrator = MeasuresTestSuite.ORCHESTRATOR;
-
- @BeforeClass
- public static void initialize() {
- orchestrator.resetData();
- orchestrator.getServer().restoreProfile(FileLocation.ofClasspath("/measure/suite/TimeMachineTest/one-issue-per-line-profile.xml"));
- orchestrator.getServer().provisionProject("sample", "Sample");
- orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");
- analyzeProject("measure/xoo-history-v1", "2014-10-19");
- analyzeProject("measure/xoo-history-v2", "2014-11-13");
- }
-
- private static BuildResult analyzeProject(String path, String date) {
- return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date));
- }
-
- @Test
- public void projectIsAnalyzed() {
- assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getVersion()).isEqualTo("1.0-SNAPSHOT");
- assertThat(orchestrator.getServer().getWsClient().find(new ResourceQuery(PROJECT)).getDate().getMonth()).isEqualTo(10); // November
- }
-
- @Test
- public void testHistoryOfIssues() {
- TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "blocker_violations", "critical_violations", "major_violations",
- "minor_violations", "info_violations");
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
- assertThat(timemachine.getCells().length).isEqualTo(2);
-
- TimeMachineCell cell1 = timemachine.getCells()[0];
- TimeMachineCell cell2 = timemachine.getCells()[1];
-
- assertThat(cell1.getDate().getMonth()).isEqualTo(9);
- assertThat(cell1.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 26L, 0L});
-
- assertThat(cell2.getDate().getMonth()).isEqualTo(10);
- assertThat(cell2.getValues()).isEqualTo(new Object[] {0L, 0L, 0L, 43L, 0L});
- }
-
- @Test
- public void testHistoryOfMeasures() {
- TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT, "lines", "ncloc");
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(query);
- assertThat(timemachine.getCells().length).isEqualTo(2);
-
- TimeMachineCell cell1 = timemachine.getCells()[0];
- TimeMachineCell cell2 = timemachine.getCells()[1];
-
- assertThat(cell1.getDate().getMonth()).isEqualTo(9);
- assertThat(cell1.getValues()).isEqualTo(new Object[] {26L, 24L});
-
- assertThat(cell2.getDate().getMonth()).isEqualTo(10);
- assertThat(cell2.getValues()).isEqualTo(new Object[] {43L, 40L});
- }
-
- @Test
- public void unknownMetrics() {
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "notfound"));
- assertThat(timemachine.getCells().length).isEqualTo(0);
-
- timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines", "notfound"));
- assertThat(timemachine.getCells().length).isEqualTo(2);
- for (TimeMachineCell cell : timemachine.getCells()) {
- assertThat(cell.getValues().length).isEqualTo(1);
- assertThat(cell.getValues()[0]).isInstanceOf(Long.class);
- }
-
- timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT));
- assertThat(timemachine.getCells().length).isEqualTo(0);
- }
-
- @Test
- public void noDataForInterval() {
- Date now = new Date();
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics(PROJECT, "lines").setFrom(now).setTo(now));
- assertThat(timemachine.getCells().length).isEqualTo(0);
- }
-
- @Test
- public void unknownResource() {
- TimeMachine timemachine = orchestrator.getServer().getWsClient().find(TimeMachineQuery.createForMetrics("notfound:notfound", "lines"));
- assertThat(timemachine).isNull();
- }
-
- @Test
- public void test_measure_variations() {
- Resource project = getProject("files", "ncloc", "violations");
-
- // period 1 : previous analysis
- assertThat(project.getPeriod1Mode()).isEqualTo("previous_analysis");
- assertThat(project.getPeriod1Date()).isNotNull();
-
- // variations from previous analysis
- assertThat(project.getMeasure("files").getVariation1()).isEqualTo(1.0);
- assertThat(project.getMeasure("ncloc").getVariation1()).isEqualTo(16.0);
- assertThat(project.getMeasure("violations").getVariation1()).isGreaterThan(0.0);
- }
-
- /**
- * SONAR-4962
- */
- @Test
- public void measure_variations_are_only_meaningful_when_includetrends() {
- String[] metricKeys = {"violations", "new_violations"};
-
- Resource projectWithTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
- assertThat(projectWithTrends.getMeasure("violations")).isNotNull();
- assertThat(projectWithTrends.getMeasure("new_violations")).isNotNull();
-
- Resource projectWithoutTrends = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(false));
- assertThat(projectWithoutTrends.getMeasure("violations")).isNotNull();
- assertThat(projectWithoutTrends.getMeasure("new_violations")).isNull();
- }
-
- private Resource getProject(String... metricKeys) {
- return orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT, metricKeys).setIncludeTrends(true));
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package testing.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.io.File;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.filefilter.TrueFileFilter;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class CoverageTest {
-
- @ClassRule
- public static Orchestrator orchestrator = TestingTestSuite.ORCHESTRATOR;
-
- private static final String[] ALL_COVERAGE_METRICS = new String[] {
- "line_coverage", "lines_to_cover", "uncovered_lines", "branch_coverage", "conditions_to_cover", "uncovered_conditions", "coverage",
- "it_line_coverage", "it_lines_to_cover", "it_uncovered_lines", "it_branch_coverage", "it_conditions_to_cover", "it_uncovered_conditions", "it_coverage",
- "overall_line_coverage", "overall_lines_to_cover", "overall_uncovered_lines", "overall_branch_coverage", "overall_conditions_to_cover", "overall_uncovered_conditions",
- "overall_coverage"
- };
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void unit_test_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(2);
- assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(1);
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("it_coverage")).isNull();
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTest/unit_test_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void unit_test_coverage_no_condition() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isNull();
- assertThat(project.getMeasureValue("conditions_to_cover")).isNull();
- assertThat(project.getMeasureValue("uncovered_conditions")).isNull();
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("it_coverage")).isNull();
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-ut-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTest/unit_test_coverage_no_condition-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void it_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isNull();
-
- assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(1);
- assertThat(project.getMeasureValue("it_coverage")).isEqualTo(50.0);
-
- assertThat(project.getMeasureValue("overall_coverage")).isNull();
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-it-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTest/it_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- @Test
- public void ut_and_it_coverage() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("branch_coverage")).isEqualTo(25.0);
- assertThat(project.getMeasureValue("conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("uncovered_conditions")).isEqualTo(3);
- assertThat(project.getMeasureValue("coverage")).isEqualTo(37.5);
-
- assertThat(project.getMeasureValue("it_line_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("it_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_lines")).isEqualTo(2);
- assertThat(project.getMeasureValue("it_branch_coverage")).isEqualTo(25.0);
- assertThat(project.getMeasureValue("it_conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("it_uncovered_conditions")).isEqualTo(3);
- assertThat(project.getMeasureValue("it_coverage")).isEqualTo(37.5);
-
- assertThat(project.getMeasureValue("overall_line_coverage")).isEqualTo(75.0);
- assertThat(project.getMeasureValue("overall_lines_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("overall_uncovered_lines")).isEqualTo(1);
- assertThat(project.getMeasureValue("overall_branch_coverage")).isEqualTo(50.0);
- assertThat(project.getMeasureValue("overall_conditions_to_cover")).isEqualTo(4);
- assertThat(project.getMeasureValue("overall_uncovered_conditions")).isEqualTo(2);
- assertThat(project.getMeasureValue("overall_coverage")).isEqualTo(62.5);
-
- String coverage = orchestrator.getServer().adminWsClient().get("api/sources/lines", "key", "sample-overall-coverage:src/main/xoo/sample/Sample.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTest/ut_and_it_coverage-expected.json"), "UTF-8"), coverage, false);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_compute_coverage_on_project() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_ignore_coverage_on_full_path() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_ignore_coverage_on_pattern() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "**/UnCovered*"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isEqualTo(100.0);
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- /**
- * SONAR-766
- */
- @Test
- public void should_not_have_coverage_at_all() {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))
- .setProperty("sonar.coverage.exclusions", "**/*"));
-
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS));
- assertThat(project.getMeasureValue("coverage")).isNull();
-
- verifyComputeEngineTempDirIsEmpty();
- }
-
- private void verifyComputeEngineTempDirIsEmpty() {
- File ceTempDirectory = new File(new File(orchestrator.getServer().getHome(), "temp"), "ce");
- assertThat(FileUtils.listFiles(ceTempDirectory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)).isEmpty();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package testing.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-
-import static util.ItUtils.projectDir;
-
-public class CoverageTrackingTest {
-
- @ClassRule
- public static Orchestrator orchestrator = TestingTestSuite.ORCHESTRATOR;
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void test_coverage_per_test() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test")));
-
- String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo");
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false);
-
- String covered_files = orchestrator.getServer().adminWsClient()
- .get("api/tests/covered_files", "testUuid", extractSuccessfulTestUuid(tests));
- JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("CoverageTrackingTest/covered_files-expected.json"), "UTF-8"), covered_files, false);
- }
-
- private String extractSuccessfulTestUuid(String json) {
- Matcher jsonObjectMatcher = Pattern.compile(".*\\{((.*?)success(.*?))\\}.*", Pattern.MULTILINE).matcher(json);
- jsonObjectMatcher.find();
-
- Matcher uuidMatcher = Pattern.compile(".*\"testUuid\"\\s*?:\\s*?\"(\\S*?)\".*", Pattern.MULTILINE).matcher(jsonObjectMatcher.group(1));
- return uuidMatcher.find() ? uuidMatcher.group(1) : "";
- }
-}
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package testing.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.assertj.core.data.Offset;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class NewCoverageTest {
-
- @ClassRule
- public static Orchestrator orchestrator = TestingTestSuite.ORCHESTRATOR;
-
- private static final String PROJECT_KEY = "sample-new-coverage";
-
- private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
-
- private static final String[] ALL_NEW_COVERAGE_METRICS = new String[] {
- "new_coverage", "new_line_coverage", "new_branch_coverage",
- "new_it_coverage", "new_it_line_coverage", "new_it_branch_coverage",
- "new_overall_coverage", "new_overall_line_coverage", "new_overall_branch_coverage"
- };
-
- @BeforeClass
- public static void analyze_project() {
- orchestrator.resetData();
-
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1"))
- .setProperty("sonar.projectDate", "2015-02-01")
- .setProperty("sonar.scm.disabled", "false")
- );
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2"))
- .setProperty("sonar.scm.disabled", "false"));
- }
-
- @Test
- public void new_unit_test_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_coverage").getVariation1()).isEqualTo(62.5d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_line_coverage").getVariation1()).isEqualTo(80d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_branch_coverage").getVariation1()).isEqualTo(33.3, DEFAULT_OFFSET);
- }
-
- @Test
- public void new_integration_test_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_it_coverage").getVariation1()).isEqualTo(85.7, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_it_line_coverage").getVariation1()).isEqualTo(100d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_it_branch_coverage").getVariation1()).isEqualTo(66.7, DEFAULT_OFFSET);
- }
-
- @Test
- public void new_overall_coverage() throws Exception {
- Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics(PROJECT_KEY, ALL_NEW_COVERAGE_METRICS).setIncludeTrends(true));
- assertThat(project.getMeasure("new_overall_coverage").getVariation1()).isEqualTo(44.4d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_overall_line_coverage").getVariation1()).isEqualTo(50d, DEFAULT_OFFSET);
- assertThat(project.getMeasure("new_overall_branch_coverage").getVariation1()).isEqualTo(42.85, DEFAULT_OFFSET);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package testing.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarRunner;
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.sonar.wsclient.services.Resource;
-import org.sonar.wsclient.services.ResourceQuery;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static util.ItUtils.projectDir;
-
-public class TestExecutionTest {
-
- @ClassRule
- public static Orchestrator orchestrator = TestingTestSuite.ORCHESTRATOR;
-
- @Before
- public void delete_data() {
- orchestrator.resetData();
- }
-
- @Test
- public void test_execution() throws Exception {
- orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution")));
-
- 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.getMeasureIntValue("test_failures")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("test_errors")).isEqualTo(1);
- assertThat(project.getMeasureIntValue("tests")).isEqualTo(4);
- 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("TestExecutionTest/expected.json"), "UTF-8"), json, false);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2009-2014 SonarSource SA
- * All rights reserved
- * mailto:contact AT sonarsource DOT com
- */
-package testing.suite;
-
-import com.sonar.orchestrator.Orchestrator;
-import org.junit.ClassRule;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import util.ItUtils;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- CoverageTrackingTest.class,
- CoverageTest.class,
- NewCoverageTest.class,
- TestExecutionTest.class
-})
-public class TestingTestSuite {
-
- @ClassRule
- public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
- .addPlugin(ItUtils.xooPlugin())
- .build();
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>copy_measure_filter</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>storeEval</td>
- <td>'list_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
-</tr>
-<tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>copy-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>copy of ${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=description</td>
- <td>description of copy</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*copy of ${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-description</td>
- <td>*description of copy*</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-<tr>
- <td>assertSelectedLabel</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>copy_uniqueness_of_name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>store</td>
- <td>javascript{'list_'+(new Date()).getTime()}</td>
- <td>FILTER_NAME</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
-</tr>
-<tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>copy-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>copy-filter-form</td>
- <td>*Name already exists*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>copy of ${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=copy-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*copy of ${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-<tr>
- <td>assertSelectedLabel</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>empty_filter</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures/search</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*No data*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Struts*</td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>initial_search_form</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>class=navigator-filters</td>
- <td>*More Criteria*</td>
- </tr>
- <tr>
- <td>assertElementNotPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>link_from_main_header</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>link=Measures</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Measures</td>
- <td></td>
- </tr>
- <tr>
- <td>assertLocation</td>
- <td>*/measures*</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>class=navigator-filters</td>
- <td></td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>configure-table-columns</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>select-metric</td>
- <td>Complexity</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=add-metric</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*</td>
- </tr>
- <tr>
- <td>select</td>
- <td>select-metric</td>
- <td>Comment lines</td>
- </tr>
- <tr>
- <td>select</td>
- <td>id=select-period</td>
- <td>label=since previous analysis</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=add-metric</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*Comment lines*last*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Cmpx*Comment lines*last*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>delete_column</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Last Analysis*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>delete-date</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Name*LOC*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Last Analysis*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*LOC*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Last Analysis*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>move_columns</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=change-display</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Name*Last Analysis*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>left-date</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Last Analysis*Name*LOC*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>right-name</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForText</td>
- <td>measures-table</td>
- <td>*Last Analysis*LOC*Name*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=exit-edit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Last Analysis*LOC*Name*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>list_sort_by_descending_name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=Name</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*b2/HelloB2.xoo*b1/HelloB1.xoo*a2/HelloA2.xoo*a1/HelloA1.xoo*</td>
- </tr>
-
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>list_sort_by_ncloc</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=LOC</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>link=LOC</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*a2/HelloA2.xoo*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>list_widget</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/measures/manage</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=login</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=password</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
- </tr>
-
- <tr>
- <td>clickAndWait</td>
- <td>xpath=(//table[contains(@id, 'shared-filters')]//a[contains(text(),'Projects')])</td>
- <td></td>
- </tr>
- <tr>
- <td>storeEval</td>
- <td>window.location.pathname.split('/').last()</td>
- <td>FILTER_ID</td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Name*Version*LOC*Last Analysis*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Multi-modules Sample*1.0-SNAPSHOT*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>block_1</td>
- <td>*Module A*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>list_widget_sort</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>storeEval</td>
- <td>'sort_widget_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>name=commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>class=navigator-filters</td>
- <td>*More Criteria*</td>
-</tr>
-<tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>name</td>
- <td>${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>storeEval</td>
- <td>window.location.pathname.split('/').last()</td>
- <td>FILTER_ID</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list&filter=${FILTER_ID}</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*Name*LOC*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=LOC</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>block_1</td>
- <td>*a2/HelloA2.xoo*a1/HelloA1.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>link=LOC</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>block_1</td>
- <td>*HelloA1*HelloB1*HelloB2*HelloA2*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>list_widget</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/widget?id=measure_filter_list</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>block_1</td>
- <td>*This widget is configured to display a measure filter that does not exist anymore.*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>save_with_special_characters</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
- </tr>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>save-as-filter-form</td>
- <td></td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=name</td>
- <td>special $àé'@"</td>
- </tr>
- <tr>
- <td>type</td>
- <td>id=description</td>
- <td>description with special characters " ' éà</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=save-as-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>filter-description</td>
- <td>*description with special characters " ' éà*</td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>id=manage-favorites</td>
- <td></td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>id=manage-favorites</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>my-filters</td>
- <td>*special $àé'@"*description with special characters " ' éà*</td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=delete_special-ae</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>confirm-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>click</td>
- <td>id=confirm-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForNotText</td>
- <td>my-filters</td>
- <td>*special $àé'@"*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>search-by-key</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Projects</td>
- </tr>
- <tr>
- <td>type</td>
- <td>name=keySearch</td>
- <td>multi-modules</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*1 results*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>search-by-name</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Projects</td>
- </tr>
- <tr>
- <td>type</td>
- <td>name=nameSearch</td>
- <td>Integration</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*1 results*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>search_for_files</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Files</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*a1/HelloA1.xoo*a2/HelloA2.xoo*b1/HelloB1.xoo*b2/HelloB2.xoo*</td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>css=#measures-table tfoot</td>
- <td>*4 results*</td>
- </tr>
- <tr>
- <td>assertNotText</td>
- <td>measures-table</td>
- <td>*Module A*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2014 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube is free software; you can redistribute it and/or
- ~ modify it under the terms of the GNU Lesser General Public
- ~ License as published by the Free Software Foundation; either
- ~ version 3 of the License, or (at your option) any later version.
- ~
- ~ SonarQube is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>search_for_projects_by_default</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
- <tbody>
- <tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
- </tr>
- <tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
- </tr>
- <tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Projects</td>
- </tr>
- <tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
- </tr>
- <tr>
- <td>assertElementPresent</td>
- <td>measures-table</td>
- <td></td>
- </tr>
- <tr>
- <td>assertText</td>
- <td>measures-table</td>
- <td>*Sonar :: Integration Tests :: Multi-modules Sample*</td>
- </tr>
- </tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>should_save_issue_filters</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<tbody>
-<tr>
- <td>storeEval</td>
- <td>'filter_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>user-measures-filter-with-no-share-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
-</tr>
-<tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Projects</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>save-as-filter-form</td>
- <td>*Save Filter*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>user_${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>save-as-filter-form</td>
- <td>*Shared with all users*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Private*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
- <title>should_save_issue_filters</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<tbody>
-<tr>
- <td>storeEval</td>
- <td>'filter_'+(new Date()).getTime()</td>
- <td>FILTER_NAME</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>user-measures-filter-with-sharing-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>name=qualifiers[]</td>
- <td></td>
-</tr>
-<tr>
- <td>select</td>
- <td>name=qualifiers[]</td>
- <td>Projects</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>class=navigator-filter-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>save-as-filter-form</td>
- <td>*Save Filter*</td>
-</tr>
-<tr>
- <td>type</td>
- <td>id=name</td>
- <td>user_${FILTER_NAME}</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=shared</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=save-as-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Shared with all users*</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures/manage</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*My Measures Filters*</td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>shared-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=star-user_${FILTER_NAME}</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>user-measures-filter-with-sharing-perm</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>password</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>id=manage-favorites</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=manage-favorites</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>my-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>id=edit_user_${FILTER_NAME}</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>edit-filter-form</td>
- <td>*Edit Filter*</td>
-</tr>
-<tr>
- <td>click</td>
- <td>shared</td>
- <td></td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>id=save-submit</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>filter-title</td>
- <td>*user_${FILTER_NAME}*Private*</td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/logout</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/sessions/new</td>
- <td></td>
-</tr>
-<tr>
- <td>type</td>
- <td>login</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>type</td>
- <td>password</td>
- <td>admin</td>
-</tr>
-<tr>
- <td>clickAndWait</td>
- <td>commit</td>
- <td></td>
-</tr>
-<tr>
- <td>open</td>
- <td>/sonar/measures/manage</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForText</td>
- <td>content</td>
- <td>*My Measures Filters*</td>
-</tr>
-<tr>
- <td>assertNotText</td>
- <td>shared-filters</td>
- <td>*user_${FILTER_NAME}*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>