Extensions Wiki » Extensions » Syntax Test Report

Changes for document Syntax Test Report

Last modified by Vincent Massol on 2012/05/18 14:11
From version 5.3
edited by Vincent Massol
on 2012/05/12 12:32
To version 6.1
edited by Vincent Massol
on 2012/05/13 18:09
Change comment: There is no comment for this version

Object changes

Object number 0 of type ExtensionCode.ExtensionClass modified

Description
... ... @@ -7,7 +7,11 @@
7 7 {{code}}
8 8 {{groovy}}
9 9 import java.net.URLDecoder
10 +import org.apache.commons.configuration.PropertiesConfiguration
10 10
12 +def config = new PropertiesConfiguration("https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/config.properties".toURL())
13 +def descriptions = config.getProperties("testDescriptions", new Properties())
14 +
11 11 enum State {
12 12 PASSED("#039915"), FAILING("#F50A21"), NOT_APPLICABLE("#C2C0C0"), MISSING("#F59B0A")
13 13 State(String color) { this.color = color }
... ... @@ -17,9 +17,15 @@
17 17
18 18 class Result {
19 19 State inResult
24 + String inSyntaxExtension
25 + String inCtsExtension
20 20 State outResult
27 + String outSyntaxExtension
28 + String outCtsExtension
21 21 }
22 22
31 +def syntaxModules = ["xwiki/2.0":"xwiki20", "xwiki/2.1":"xwiki21", "xwiki/1.0":"xwiki10"]
32 +
23 23 def tests = [] as Set
24 24 def testsBySyntax = [:]
25 25
... ... @@ -28,12 +28,14 @@
28 28 def root = new XmlSlurper().parseText(url)
29 29
30 30 root."case".each() { it ->
31 - def testAsString = it.name.text().replaceAll("\\\\/", "/")
32 - def matcher = testAsString =~ "(.*)\\((.*)\\) \\[(.*)\\](.*)"
33 - def syntaxId = matcher[0][3]
34 - def type = matcher[0][2]
41 + def testAsString = it.name.text().replaceAll("\\\\/", "/").replaceAll("\\\\u002C", ",")
42 + def matcher = testAsString =~ "(.*) \\[(.*), (.*):(.*), CTS:(.*)\\](.*)"
43 + def syntaxId = matcher[0][2]
44 + def type = matcher[0][3]
35 35 def name = matcher[0][1]
36 - def stateAsString = matcher[0][4]
46 + def syntaxExtension = matcher[0][4]
47 + def ctsExtension = matcher[0][5]
48 + def stateAsString = matcher[0][6]
37 37 def state
38 38 if (it.skipped == "true") {
39 39 if (stateAsString == " - Not working") {
... ... @@ -61,8 +61,12 @@
61 61
62 62 if (type == "IN") {
63 63 result.inResult = state
76 + result.inSyntaxExtension = syntaxExtension
77 + result.inCtsExtension = ctsExtension
64 64 } else {
65 65 result.outResult = state
80 + result.outSyntaxExtension = syntaxExtension
81 + result.outCtsExtension = ctsExtension
66 66 }
67 67 }
68 68
... ... @@ -85,17 +85,51 @@
85 85
86 86 testsBySyntax = testsBySyntax.sort()
87 87
88 -println "{{box cssClass='floatinginfobox' title='**Legend**'}}"
104 +println "{{box cssClass='floatinginfobox'}}"
105 +println "**Legend**"
89 89 println "|(% style='background-color: ${State.PASSED.color()}' %)|Passed test"
90 90 println "|(% style='background-color: ${State.FAILING.color()}' %)|Failing test (needs to be fixed)"
91 91 println "|(% style='background-color: ${State.MISSING.color()}' %)|Missing test (needs to be written)"
92 -println "|(% style='background-color: ${State.NOT_APPLICABLE.color()}' %)|Not applicable"
109 +println "|(% style='background-color: ${State.NOT_APPLICABLE.color()}' %)|Not supported"
110 +println ""
111 +println "**Test Descriptions**"
112 +tests.each() { name ->
113 + println "|${name}|${descriptions.get(name)}"
114 +}
93 93 println "{{/box}}"
94 94
95 95 println "|=Syntax|=Test|=Result IN|=Result OUT"
96 96 testsBySyntax.each() { syntax, testByName ->
119 +
120 + // Find the syntax module name
121 + def syntaxResourceName = syntax.replace("/", "").replace(".", "")
122 + def syntaxModuleName = syntaxModules.get(syntax)
123 + if (!syntaxModuleName) {
124 + syntaxModuleName = syntax.find(/\w+/)
125 + }
126 + def syntaxLocation = "https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-syntaxes/xwiki-rendering-syntax-${syntaxModuleName}/src/test/resources/${syntaxResourceName}"
127 +
97 97 testByName.each() { name, result ->
98 - println "|${syntax}|${name}|(% style='background-color: ${result.inResult.color()}' %)|(% style='background-color: ${result.outResult.color()}' %)"
129 +
130 + def inCellResult
131 + if (result.inResult != State.NOT_APPLICABLE) {
132 + def syntaxInCell = "${syntaxLocation}/${name}${result.inSyntaxExtension}"
133 + def ctsInCell = "https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/${name}${result.inCtsExtension}"
134 + inCellResult = "(% style='background-color: ${result.inResult.color()}' %)[[IN>>${syntaxInCell}]] / [[CTS>>${ctsInCell}]]"
135 + } else {
136 + inCellResult = "(% style='background-color: ${result.inResult.color()}' %)"
137 + }
138 +
139 + def outCellResult
140 + if (result.outResult != State.NOT_APPLICABLE) {
141 + def syntaxOutCell = "${syntaxLocation}/${name}${result.outSyntaxExtension}"
142 + def ctsOutCell = "https://raw.github.com/xwiki/xwiki-rendering/master/xwiki-rendering-test/src/main/resources/cts/${name}${result.outCtsExtension}"
143 + outCellResult = "(% style='background-color: ${result.outResult.color()}' %)[[CTS>>${ctsOutCell}]] / [[OUT>>${syntaxOutCell}]]"
144 + } else {
145 + outCellResult = "(% style='background-color: ${result.outResult.color()}' %)"
146 + }
147 +
148 + println "|${syntax}|${name}|${inCellResult}|${outCellResult}"
99 99 }
100 100 }
101 101 {{/groovy}}

Download XWiki