package it.highlighting;
import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.build.SonarScanner;
import com.sonar.orchestrator.selenium.Selenese;
import it.Category4Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
-import util.ItUtils;
+
+import static util.ItUtils.runProjectAnalysis;
public class HighlightingTest {
orchestrator.resetData();
}
+ @Test
+ public void highlight_source_code_and_symbols_usage() throws Exception {
+ runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v2");
+
+ Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("highlight_source_code_and_symbols_usage",
+ // SONAR-3893 & SONAR-4247
+ "/highlighting/HighlightingTest/syntax-highlighting.html",
+ // SONAR-4249 & SONAR-4250
+ "/highlighting/HighlightingTest/symbol-usages-highlighting.html"
+ ).build();
+ orchestrator.executeSelenese(selenese);
+ }
+
// Check that E/S index is updated when file content is unchanged but plugin generates different syntax/symbol highlighting
@Test
- public void updateHighlightingEvenWhenCodeUnchanged() throws Exception {
- SonarScanner runner = SonarScanner.create(ItUtils.projectDir("highlighting/xoo-sample-with-highlighting-v1"));
- orchestrator.executeBuild(runner);
+ public void update_highlighting_even_when_code_unchanged() throws Exception {
+ runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v1");
Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("syntax-highlighting-v1",
"/highlighting/HighlightingTest/syntax-highlighting-v1.html").build();
orchestrator.executeSelenese(selenese);
- runner = SonarScanner.create(ItUtils.projectDir("highlighting/xoo-sample-with-highlighting-v2"));
- orchestrator.executeBuild(runner);
+ runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v2");
selenese = Selenese.builder().setHtmlTestsInClasspath("syntax-highlighting-v2",
"/highlighting/HighlightingTest/syntax-highlighting-v2.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>java-syntax-highlighting</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">highlight-syntax</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/component/index?id=sample-with-highlighting%3Asrc%2Fmain%2Fxoo%2Fsample%2FSample.xoo</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForElementPresent</td>
+ <td>css=.source-line</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>storeHtmlSource</td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>verifyHtmlSource</td>
+ <td>glob:*<span class="k">package</span>*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>verifyHtmlSource</td>
+ <td>glob:*<span class="k">public</span>*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>verifyHtmlSource</td>
+ <td>glob:*<span class="k">class</span>*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>verifyHtmlSource</td>
+ <td>glob:*<span class="k">return</span>*</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>verifyHtmlSource</td>
+ <td>glob:*<span class="s">"hello"</span>*</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>