Show last authors
1 {{info}}
2 This page is [[dynamically generated>>||queryString="viewer=code"]] from the unit tests results executed by our Jenkins CI server. Thus it's possible that this page will fail or display incomplete results if the CI jobs have had issues building.
3 {{/info}}
4
5 {{cache id="syntaxreport6"}}
6 {{ctsdata}}
7 {{groovy}}
8 def urlPrefixes = [
9 "http://ci.xwiki.org/job/XWiki/job/xwiki-rendering/job/master",
10 "http://ci.xwiki.org/job/XWiki%20Contrib/job/syntax-markdown/job/master",
11 "http://ci.xwiki.org/job/XWiki%20Contrib/job/mediawiki/job/master",
12 "http://ci.xwiki.org/job/XWiki%20Contrib/job/confluence/job/master",
13 "http://ci.xwiki.org/job/XWiki%20Contrib/job/dokuwiki/job/master"
14 ]
15 // TODO: Add "http://ci.xwiki.org/job/XWiki%20Contrib/job/latex/job/master" when CI is ready
16 urlPrefixes.each() { urlPrefix ->
17 def content = "${urlPrefix}/lastSuccessfulBuild/testReport/api/xml?xpath=//suite/case/className%5Btext()%20=%20'org.xwiki.rendering.test.cts.RenderingTest'%5D/..&wrapper=root".toURL().text
18 def root = new XmlSlurper().parseText(content)
19 root."case".each() { it ->
20 def testAsString = it.name.text().replaceAll("\\\\/", "/").replaceAll("\\\\u002C", ",")
21 if (it.skipped == "false") {
22 testAsString = "${testAsString} - Passed"
23 }
24 println testAsString
25 }
26 }
27 {{/groovy}}
28 {{/ctsdata}}
29
30 {{groovy}}
31 import org.apache.commons.configuration.PropertiesConfiguration
32 import org.xwiki.rendering.internal.macro.ctsreport.State
33
34 def colors = [FAILING:"F50A21", NOT_APPLICABLE:"C2C0C0", PASSED:"039915", MISSING:"F59B0A"]
35
36 def descriptions
37 try {
38 def config = new PropertiesConfiguration("https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/config.properties".toURL())
39 descriptions = config.getProperties("testDescriptions", new Properties())
40 } catch (e) {
41 descriptions = new Properties()
42 }
43
44 println "{{box cssClass=''}}"
45 println "**Legend**"
46 println "|(% style='background-color: #${colors.get("PASSED")}' %)|Passed test"
47 println "|(% style='background-color: #${colors.get("FAILING")}' %)|Failing test"
48 println "|(% style='background-color: #${colors.get("MISSING")}' %)|Missing test (needs to be written, could pass or fail)"
49 println "|(% style='background-color: #${colors.get("NOT_APPLICABLE")}' %)|Not supported"
50 if (!descriptions.isEmpty()) {
51 println ""
52 println "**Test Descriptions** (${ctsTestNames.size()} tests)"
53 ctsTestNames.each() { name ->
54 println "|${name}|${descriptions.get(name)}"
55 }
56 }
57 println "{{/box}}"
58 println ""
59
60 def syntaxModules = ["xwiki/2.0":"xwiki20", "xwiki/2.1":"xwiki21", "xwiki/1.0":"xwiki10"]
61
62 def buffer = []
63 def completeness = [:]
64
65 ctsTests = ctsTests.sort()
66 ctsTests.each() { syntax, inOutTests ->
67 def nbTests = [FAILING:0, NOT_APPLICABLE:0, PASSED:0, MISSING:0 ]
68 def nbTotal = 0
69 def nbPassed = 0
70
71 // Find the syntax module name
72 def syntaxResourceName = syntax.replace("/", "").replace(".", "")
73 def syntaxModuleName = syntaxModules.get(syntax)
74 if (!syntaxModuleName) {
75 syntaxModuleName = syntax.find(/\w+/)
76 }
77 def syntaxLocation = "https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-syntaxes/xwiki-rendering-syntax-${syntaxModuleName}/src/test/resources/${syntaxResourceName}"
78
79 buffer.add("{{id name='${syntax}'/}}")
80 buffer.add("= Syntax: ${syntax} =")
81
82 def syntaxBuffer = []
83
84 def inTests = inOutTests.getLeft()
85 if (inTests.isEmpty()) {
86 syntaxBuffer.add("There is no Parser for this syntax.")
87 } else {
88 syntaxBuffer.add("Parser Tests:")
89 syntaxBuffer.add("|=Input|=Expected Output|=Result")
90 inTests.each() { test ->
91
92 int nb = nbTests.get(test.state.toString())
93 nbTests.put(test.state.toString(), ++nb)
94 nbTotal++
95 if (test.state == State.PASSED || test.state == State.NOT_APPLICABLE) { nbPassed++ }
96
97 def syntaxExtension = test.syntaxExtension ?: ""
98 def ctsExtension = test.ctsExtension ?: ""
99
100 // Compute link to sources
101 def ctsCell = "[[${test.prefix}${syntaxExtension}>>https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/${test.prefix}${ctsExtension}]]"
102 def syntaxCell = "[[${test.prefix}${syntaxExtension}>>${syntaxLocation}/${test.prefix}${test.syntaxExtension}]]"
103
104 syntaxBuffer.add("|${syntaxCell}|${ctsCell}|(% style='background-color: #${colors.get(test.state.name())}' %)")
105 }
106 }
107 syntaxBuffer += ""
108
109 def outTests = inOutTests.getRight()
110 if (outTests.isEmpty()) {
111 syntaxBuffer.add("There is no Renderer for this syntax.")
112 } else {
113 syntaxBuffer.add("Renderer Tests:")
114 syntaxBuffer.add("|=Input|=Expected Output|=Result")
115 outTests.each() { test ->
116
117 int nb = nbTests.get(test.state.toString())
118 nbTests.put(test.state.toString(), ++nb)
119 nbTotal++
120 if (test.state == State.PASSED || test.state == State.NOT_APPLICABLE) { nbPassed++ }
121
122 def syntaxExtension = test.syntaxExtension ?: ""
123 def ctsExtension = test.ctsExtension ?: ""
124
125 // Compute link to sources
126 def ctsCell = "[[${test.prefix}${syntaxExtension}>>https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/${test.prefix}${ctsExtension}]]"
127 def syntaxCell = "[[${test.prefix}${syntaxExtension}>>${syntaxLocation}/${test.prefix}${test.syntaxExtension}]]"
128
129 syntaxBuffer.add("|${ctsCell}|${syntaxCell}|(% style='background-color: #${colors.get(test.state.name())}' %)")
130 }
131 }
132
133 def chartBuffer = []
134 def colorsAsString = colors.values().join(',')
135 chartBuffer.add("{{chart type='pie' source='inline' params='range:B2-B${nbTests.size() + 1};series:columns;colors:${colorsAsString}' title='Summary for ${syntax}'}}")
136 chartBuffer.add("| |Value")
137 nbTests.each() { state, nb ->
138 chartBuffer.add("|${state}|${nb}")
139 }
140 chartBuffer.add("{{/chart}}")
141
142 syntaxBuffer.addAll(0, chartBuffer)
143 buffer.addAll(syntaxBuffer)
144
145 completeness.put(syntax, Math.round(100.0*(nbPassed/nbTotal)))
146 }
147
148 // Add Summary Table
149
150 println "Test Reports for the following syntaxes:"
151 println ""
152 println "|=Syntax|=% Completeness"
153 //println "{{toc/}}"
154 //println ""
155 ctsTests.keySet().each() { syntax ->
156 println "|[[${syntax}>>||anchor='${syntax}']]|((({{html}}<div style='width:200px; border:1px solid grey; padding:3px;'><div style='width:${completeness.get(syntax)}%; background:green;'>${completeness.get(syntax)}%</div></div>{{/html}})))"
157 }
158 println ""
159
160 buffer.each() { println it }
161 {{/groovy}}
162 {{/cache}}
  • Powered by XWiki 12.6.4-node2. Hosted and managed by XWiki SAS

Get Connected