Skip to content

Commit 2880f27

Browse files
authored
Merge pull request #195 from marklogic-community/feature/180-better-labels
#180 Improving labels in UI
2 parents 6a643ea + df38b20 commit 2880f27

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

marklogic-unit-test-modules/src/main/ml-modules/root/test/default.xqy

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ declare function local:main() {
107107
<tr>
108108
<th><input id="checkall" type="checkbox" checked="checked"/>Run</th>
109109
<th>Test Suite</th>
110-
<th>Total Test Count</th>
111-
<th>Tests Run</th>
110+
<th>Test Cases</th>
111+
<th>Assertions</th>
112112
<th>Passed</th>
113113
<th>Failed</th>
114114
</tr>
@@ -128,7 +128,14 @@ declare function local:main() {
128128
{fn:data($suite/@path)} <span class="spinner"><img src="img/spinner.gif"/><b>Running...</b></span>
129129
</div>
130130
</td>
131-
<td>{fn:count($suite/test:tests/test:test)}</td>
131+
<td>{
132+
fn:count(
133+
for $test in $suite/test:tests/test:test
134+
let $path := $test/@path/fn:string()
135+
where fn:not(test:is-either-setup-or-teardown-module($path))
136+
return $test
137+
)
138+
}</td>
132139
<td class="tests-run">-</td>
133140
<td class="passed">-</td>
134141
<td class="right failed">-</td>
@@ -139,15 +146,16 @@ declare function local:main() {
139146
<div class="wrapper"><input class="check-all-tests" type="checkbox" checked="checked"/>Run All Tests</div>
140147
<ul class="tests">
141148
{
142-
for $test in ($suite/test:tests/test:test)
149+
for $test in $suite/test:tests/test:test
150+
let $path := $test/@path/fn:string()
143151
return
144-
<li class="tests {if (fn:matches($test/@path, '(S|s)etup\.')) then 'setup-module-hidden' else if (fn:matches($test/@path, '(T|t)eardown\.')) then 'teardown-module-hidden' else ()}">
152+
<li class="tests {if (test:is-either-setup-module($path)) then 'setup-module-hidden' else if (test:is-either-teardown-module($path)) then 'teardown-module-hidden' else ()}">
145153
{
146-
if (fn:matches($test/@path, "^suite((-s|S)etup|(-t|T)eardown\.)")) then
147-
<input type="hidden" value="{fn:data($test/@path)}"/>
154+
if (test:is-suite-setup-module($path) or test:is-suite-teardown-module($path)) then
155+
<input type="hidden" value="{$path}"/>
148156
else
149-
<input class="test-cb" type="checkbox" checked="checked" value="{fn:data($test/@path)}"/>,
150-
fn:string($test/@path)
157+
<input class="test-cb" type="checkbox" checked="checked" value="{$path}"/>,
158+
$path
151159
}<span class="outcome"></span>
152160
</li>
153161
}

marklogic-unit-test-modules/src/main/ml-modules/root/test/test-controller.xqy

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,30 @@ declare function invoke-setup-teardown-module($start-time as xs:dayTimeDuration,
354354
};
355355

356356
(: setup/teardown checks :)
357-
declare function is-setup-module($file-name as xs:string) {
358-
fn:matches($file-name, "(^|/)setup\.")
357+
declare function is-setup-module($path as xs:string) as xs:boolean {
358+
fn:matches($path, "(^|/)setup\.")
359359
};
360360

361-
declare function is-teardown-module($file-name as xs:string) {
362-
fn:matches($file-name, "(^|/)teardown\.")
361+
declare function is-teardown-module($path as xs:string) as xs:boolean {
362+
fn:matches($path, "(^|/)teardown\.")
363363
};
364364

365-
declare function is-suite-setup-module($file-name as xs:string) {
366-
fn:matches($file-name, "(^|/)suite(-s|S)etup\.")
365+
declare function is-suite-setup-module($path as xs:string) as xs:boolean {
366+
fn:matches($path, "(^|/)suite(-s|S)etup\.")
367367
};
368368

369-
declare function is-suite-teardown-module($file-name as xs:string) {
370-
fn:matches($file-name, "(^|/)suite(-t|T)eardown\.")
369+
declare function is-suite-teardown-module($path as xs:string) as xs:boolean {
370+
fn:matches($path, "(^|/)suite(-t|T)eardown\.")
371+
};
372+
373+
declare function is-either-setup-module($path as xs:string) as xs:boolean {
374+
is-setup-module($path) or is-suite-setup-module($path)
375+
};
376+
377+
declare function is-either-teardown-module($path as xs:string) as xs:boolean {
378+
is-teardown-module($path) or is-suite-teardown-module($path)
379+
};
380+
381+
declare function is-either-setup-or-teardown-module($path as xs:string) as xs:boolean {
382+
is-either-setup-module($path) or is-either-teardown-module($path)
371383
};

0 commit comments

Comments
 (0)