5
5
component {
6
6
7
7
/**
8
- * @print a print buffer to use
9
8
* @testData test results from TestBox
10
9
*/
11
- function render ( print , testData ){
10
+ function render ( testData ){
12
11
for ( this Bundle in testData .bundleStats ) {
13
12
// Check if the bundle threw a global exception
14
13
if ( ! isSimpleValue ( this Bundle .globalException ) ) {
15
14
var message = escapeLF (
16
15
" #this Bundle .globalException .type #:#this Bundle .globalException .message #:#this Bundle .globalException .detail #"
17
16
);
18
- print . line ( prependLF ( " <ERROR::>#message #" ) );
17
+ printLine ( prependLF ( " <ERROR::>#message #" ) );
19
18
20
19
// ACF has an array for the stack trace
21
20
if ( isSimpleValue ( this Bundle .globalException .stacktrace ) ) {
22
- print . line ( prependLF ( " <LOG::-Stacktrace>#escapeLF ( this Bundle .globalException .stacktrace ) #" ) );
21
+ printLine ( prependLF ( " <LOG::-Stacktrace>#escapeLF ( this Bundle .globalException .stacktrace ) #" ) );
23
22
}
24
23
}
25
24
26
25
var debugMap = prepareDebugBuffer ( this Bundle .debugBuffer );
27
26
28
27
// Generate reports for each suite
29
28
for ( var suiteStats in this Bundle .suiteStats ) {
30
- genSuiteReport ( suiteStats = suiteStats , bundleStats = this Bundle , print = print , debugMap = debugMap );
29
+ genSuiteReport ( suiteStats = suiteStats , bundleStats = this Bundle , debugMap = debugMap );
31
30
}
32
31
}
33
32
}
@@ -36,28 +35,27 @@ component {
36
35
* Recursive Output for suites
37
36
* @suiteStats Suite stats
38
37
* @bundleStats Bundle stats
39
- * @print The print Buffer
40
38
*/
41
- function genSuiteReport ( required suiteStats , required bundleStats , required print , debugMap = {}, labelPrefix = ' ' ){
39
+ function genSuiteReport ( required suiteStats , required bundleStats , debugMap = {}, labelPrefix = ' ' ){
42
40
labelPrefix & = ' /' & arguments .suiteStats .name ;
43
- print . line ( prependLF ( " <DESCRIBE::>#arguments .suiteStats .name #" ) );
41
+ printLine ( prependLF ( " <DESCRIBE::>#arguments .suiteStats .name #" ) );
44
42
45
43
for ( local .this Spec in arguments .suiteStats .specStats ) {
46
44
var this SpecLabel = labelPrefix & ' /' & local .this Spec .name ;
47
- print . line ( prependLF ( " <IT::>#local .this Spec .name #" ) );
45
+ printLine ( prependLF ( " <IT::>#local .this Spec .name #" ) );
48
46
49
47
if ( debugMap .keyExists ( this SpecLabel ) ) {
50
- print . line ( debugMap [ this SpecLabel ] )
48
+ printLine ( debugMap [ this SpecLabel ] )
51
49
}
52
50
53
51
if ( local .this Spec .status == " passed" ) {
54
- print . line ( prependLF ( " <PASSED::>Test Passed" ) );
52
+ printLine ( prependLF ( " <PASSED::>Test Passed" ) );
55
53
} else if ( local .this Spec .status == " failed" ) {
56
- print . line ( prependLF ( " <FAILED::>#escapeLF ( local .this Spec .failMessage ) #" ) );
54
+ printLine ( prependLF ( " <FAILED::>#escapeLF ( local .this Spec .failMessage ) #" ) );
57
55
} else if ( local .this Spec .status == " skipped" ) {
58
- print . line ( prependLF ( " <FAILED::>Test Skipped" ) );
56
+ printLine ( prependLF ( " <FAILED::>Test Skipped" ) );
59
57
} else if ( local .this Spec .status == " error" ) {
60
- print . line ( prependLF ( " <ERROR::>#escapeLF ( local .this Spec .error .message ) #" ) );
58
+ printLine ( prependLF ( " <ERROR::>#escapeLF ( local .this Spec .error .message ) #" ) );
61
59
62
60
var errorStack = [];
63
61
// If there's a tag context, show the file name and line number where the error occurred
@@ -78,23 +76,23 @@ component {
78
76
return " at #item .template #:#item .line #" ;
79
77
} )
80
78
.toList ( " <:LF:>" );
81
- print . line ( prependLF ( " <LOG::-Stacktrace>#stacktrace #" ) );
79
+ printLine ( prependLF ( " <LOG::-Stacktrace>#stacktrace #" ) );
82
80
}
83
81
} else {
84
- print . line ( prependLF ( " <ERROR::>Unknown test status: #local .this Spec .status #" ) );
82
+ printLine ( prependLF ( " <ERROR::>Unknown test status: #local .this Spec .status #" ) );
85
83
}
86
84
87
- print . line ( prependLF ( " <COMPLETEDIN::>#local .this Spec .totalDuration #" ) );
85
+ printLine ( prependLF ( " <COMPLETEDIN::>#local .this Spec .totalDuration #" ) );
88
86
}
89
87
90
88
// Handle nested Suites
91
89
if ( arguments .suiteStats .suiteStats .len () ) {
92
90
for ( local .nestedSuite in arguments .suiteStats .suiteStats ) {
93
- genSuiteReport ( local .nestedSuite , arguments .bundleStats , print , debugMap , labelPrefix )
91
+ genSuiteReport ( local .nestedSuite , arguments .bundleStats , debugMap , labelPrefix )
94
92
}
95
93
}
96
94
97
- print . line ( prependLF ( " <COMPLETEDIN::>#arguments .suiteStats .totalDuration #" ) );
95
+ printLine ( prependLF ( " <COMPLETEDIN::>#arguments .suiteStats .totalDuration #" ) );
98
96
}
99
97
100
98
private function escapeLF ( required text ){
@@ -115,4 +113,8 @@ component {
115
113
116
114
}
117
115
116
+ private function printLine ( string str ) {
117
+ systemoutput ( str , 1 );
118
+ }
119
+
118
120
}
0 commit comments