lib/VSGDR/UnitTest/TestSet/Representation/XML.pm

filter: Statementstmt 11.2% 33 / 293 Branchbran 0.0% 0 / 94 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 44.0% 11 / 25 Podpod 0.0% 0 / 13 totaltotal 9.6% 44 / 458 SCAR 82.3
CC
69
Cov
8%
parse
272.0
xmlTests
272.0
xmlGlobalConditions
132.0
CRAP 3765.7
« lib/VSGDR/UnitTest/TestSet/Representation/XLS.pm ↑ Summary lib/VSGDR/UnitTest/TestSet/Representation/NET/VB.pm »
1 package VSGDR::UnitTest::TestSet::Representation::XML;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 #our \$VERSION = '1.01';
9  
10  
11 #TODO 1. Add support for test method attributes eg new vs2010 exceptions ala : -[ExpectedSqlException(MessageNumber = nnnnn, Severity = x, MatchFirstError = false, State = y)]
12  
13 1 ▶use parent qw(VSGDR::UnitTest::TestSet::Representation) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use English;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use XML::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use VSGDR::UnitTest::TestSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use VSGDR::UnitTest::TestSet::Test;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Data::Dumper ;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶use Carp ;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24  
25 1 ▶use vars qw($AUTOLOAD );
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27  
28  
29 sub _init {
30  
31 0 ▶ local $_ = undef ;
Subroutine _init: not called CC=3 SCAR=24.8
32  
33 0 my $self = shift ;
34 0 ▶ my $class = ref($self) || $self ;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
35 0 ▶ my $ref = shift or croak "no arg";
Branch: 1 branch
BranchTrueFalseTotal
my $ref = shift() or croak("no arg") 0 0 0
36  
37  
38 0 my ${Caller} = $$ref{NAMESPACE};
39
40 0 return ;
41
42 }
43  
44 ## ======================================================
45  
46 sub parse {
47  
48 0 ▶ my $self = shift or croak 'no self' ;
Subroutine parse: not called CC=16 SCAR=56.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
49 0 ▶ my $code = shift or croak 'no code' ;
Branch: 1 branch
BranchTrueFalseTotal
my $code = shift() or croak("no code") 0 0 0
50
51 0 my $ref = XMLin($code);
52  
53 0 my %testSetActions ;
54 #warn Dumper $ref ;
55 #exit;
56 my @testConditions ;
57  
58 0 my %Globals = map { $$ref{TestGlobals}{$_} =~ s/^\s*(.*?)\s*$/$1/x;
59 0 { uc($_) => $$ref{TestGlobals}{$_}
60 }
61 }
62 0 keys %{$$ref{TestGlobals}} ;
63
64 #print Dumper %Globals ;
65 #exit;
66 my $testSet = VSGDR::UnitTest::TestSet->new( { NAMESPACE => $Globals{TESTNAMESPACE}
67 , CLASSNAME => $Globals{TESTCLASS}
68 }
69 0 ) ;
70 #print Dumper $testSet ;
71 #exit;
72 0 my $ra_testGlobalConditions = () ;
73
74 #print Dumper $$ref{TestGlobalConditions} ;
75 #exit;
76  
77 # {TestGlobalConditions}{TestInitializeConditions}
78 # {TestGlobalConditions}{TestCleanupConditions}
79  
80 0 ▶ if ( defined ($$ref{TestGlobalConditions})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeAction"}) 0 0 0
Condition0%0/3
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeAction"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeAction"}
defined $ref->{"TestGlobalConditions"} defined $ref->{"TestGlobalConditions"}{"TestInitializeAction"}
Truth table0%0/3
A and B
A= defined $ref->{"TestGlobalConditions"}B= defined $ref->{"TestGlobalConditions"}{"TestInitializeAction"}
ABresult
0X0
100
111
81 and defined ($$ref{TestGlobalConditions}{TestInitializeAction})
82 ) {
83 0 $testSet->initializeAction('testInitializeAction') ;
84 0 $testSetActions{'testInitializeAction'} = 1 ;
85 }
86 0 ▶ if ( defined ($$ref{TestGlobalConditions})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref->{'TestGlobalConditions'} and defined $ref->{'TestGlobalConditions'}{'TestInitializeConditions'} and defined $ref->{'TestGlobalConditions'}{'TestInitializeConditions'}{'TestInitializeCondition'}) { } 0 0 0
Condition0%0/6
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}{"TestInitializeCondition"}
!ll&&!rl&&r
000
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"} and defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}{"TestInitializeCondition"}
defined $ref->{"TestGlobalConditions"} defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"} defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}{"TestInitializeCondition"}
Truth table0%0/4
A and B and C
A= defined $ref->{"TestGlobalConditions"}B= defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}C= defined $ref->{"TestGlobalConditions"}{"TestInitializeConditions"}{"TestInitializeCondition"}
ABCresult
0XX0
10X0
1100
1111
87 and defined ($$ref{TestGlobalConditions}{TestInitializeConditions})
88 and defined ($$ref{TestGlobalConditions}{TestInitializeConditions}{TestInitializeCondition})
89 ) {
90 0 $testSet->initializeAction('testInitializeAction') ;
91 0 $testSetActions{'testInitializeAction'} = 1 ;
92 0 my $condition = $$ref{TestGlobalConditions}{TestInitializeConditions}{TestInitializeCondition} ;
93 #print Dumper $condition ;
94 0 $ra_testGlobalConditions = $self->gatherTestSetConditions($condition) ;
95 #print Dumper @testGlobalConditions ;
96 0 $testSet->initializeConditions($ra_testGlobalConditions);
97 }
98 else {
99 0 $testSet->initializeConditions([]);
100 }
101  
102 0 ▶ if ( defined ($$ref{TestGlobalConditions})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupAction"}) 0 0 0
Condition0%0/3
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupAction"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupAction"}
defined $ref->{"TestGlobalConditions"} defined $ref->{"TestGlobalConditions"}{"TestCleanupAction"}
Truth table0%0/3
A and B
A= defined $ref->{"TestGlobalConditions"}B= defined $ref->{"TestGlobalConditions"}{"TestCleanupAction"}
ABresult
0X0
100
111
103 and defined ($$ref{TestGlobalConditions}{TestCleanupAction})
104 ) {
105 0 $testSet->cleanupAction('testCleanupAction') ;
106 0 $testSetActions{'testTestCleanup'} = 1 ;
107 }
108 0 ▶ if ( defined ($$ref{TestGlobalConditions})
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref->{'TestGlobalConditions'} and defined $ref->{'TestGlobalConditions'}{'TestCleanupConditions'} and defined $ref->{'TestGlobalConditions'}{'TestCleanupConditions'}{'TestCleanupCondition'}) { } 0 0 0
Condition0%0/6
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}{"TestCleanupCondition"}
!ll&&!rl&&r
000
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $ref->{"TestGlobalConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"} and defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}{"TestCleanupCondition"}
defined $ref->{"TestGlobalConditions"} defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"} defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}{"TestCleanupCondition"}
Truth table0%0/4
A and B and C
A= defined $ref->{"TestGlobalConditions"}B= defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}C= defined $ref->{"TestGlobalConditions"}{"TestCleanupConditions"}{"TestCleanupCondition"}
ABCresult
0XX0
10X0
1100
1111
109 and defined ($$ref{TestGlobalConditions}{TestCleanupConditions})
110 and defined ($$ref{TestGlobalConditions}{TestCleanupConditions}{TestCleanupCondition})
111 ) {
112 0 $testSet->cleanupAction('testCleanupAction') ;
113 0 $testSetActions{'testCleanupAction'} = 1 ;
114 0 my $condition = $$ref{TestGlobalConditions}{TestCleanupConditions}{TestCleanupCondition} ;
115 #print Dumper $condition ;
116 0 $ra_testGlobalConditions = $self->gatherTestSetConditions($condition) ;
117 #print Dumper @testGlobalConditions ;
118 0 $testSet->cleanupConditions($ra_testGlobalConditions);
119 }
120 else {
121 0 $testSet->cleanupConditions([]);
122 }
123
124 #############################################
125  
126 0 my @testObjects = () ;
127  
128 0 ▶ if ( ref($$ref{Tests}{Test}) eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ref->{'Tests'}{'Test'} eq 'HASH') { } 0 0 0
elsif (ref $ref->{'Tests'}{'Test'} eq 'ARRAY') { } 0 0 0
129 0 my $test = $$ref{Tests}{Test} ;
130 0 my $testObject = $self->createTest($test,\%testSetActions) ;
131 0 push @testObjects, $testObject ;
132 }
133 elsif ( ref($$ref{Tests}{Test}) eq 'ARRAY' ) {
134 0 foreach my $test (@{$$ref{Tests}{Test}}) {
135 0 my $testObject = $self->createTest($test,\%testSetActions) ;
136 0 push @testObjects, $testObject ;
137 }
138 }
139 #print Dumper $testSet;
140 0 $testSet->tests(\@testObjects) ;
141 # $testSet->actions({}) ;
142 # $testSet->actions(\%testSetActions) ;
143 #print Dumper $testSet ;
144 0 return $testSet;
145 }
146  
147 sub createTest {
148 0 ▶ local $_ = undef ;
Subroutine createTest: not called CC=7 SCAR=40.3
Pod undocumented
149 0 ▶ my $self = shift or croak 'no self' ;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
150 0 ▶ my $test = shift or croak 'no test arg' ;
Branch: 1 branch
BranchTrueFalseTotal
my $test = shift() or croak("no test arg") 0 0 0
151 0 ▶ my $rh_testSetActions = shift or croak 'no test set actions' ;
Branch: 1 branch
BranchTrueFalseTotal
my $rh_testSetActions = shift() or croak("no test set actions") 0 0 0
152  
153 0 ( my $testName = $$test{TestName} ) =~ s/^\s*(.*?)\s*$/$1/x;
154 0 ( my $testActions = $$test{TestActions} ) ;
155 0 ( my $testActionData = $$test{TestActions}{TestActionData} ) ;
156  
157 0 ( my $preTestConditions = $$test{TestActions}{TestActionData}{PretestConditions}{TestCondition} ) ;
158 0 ( my $testConditions = $$test{TestActions}{TestActionData}{TestConditions}{TestCondition} ) ;
159 0 ( my $postTestConditions= $$test{TestActions}{TestActionData}{PosttestConditions}{TestCondition} ) ;
160  
161  
162 0 my ${TestActionDataName} = $$testActionData{TestActionDataName};
163 0 my ${PreTestAction} = $$testActionData{PretestAction};
164 0 my ${TestAction} = $$testActionData{TestAction};
165 0 my ${PostTestAction} = $$testActionData{PosttestAction};
166  
167 0 my $testObject = VSGDR::UnitTest::TestSet::Test->new( { TESTNAME => $testName
168 , TESTACTIONDATANAME => ${TestActionDataName}
169 , PRETESTACTION => ${PreTestAction}
170 , TESTACTION => ${TestAction}
171 , POSTTESTACTION => ${PostTestAction}
172 } ) ;
173  
174 0 my @preTestConditions = $self->gatherConditions(${preTestConditions}) ;
175 0 my @testConditions = $self->gatherConditions(${testConditions}) ;
176 0 my @postTestConditions = $self->gatherConditions(${postTestConditions}) ;
177  
178 0 my @Conditions = flatten ([@preTestConditions,@testConditions,@postTestConditions]);
179 # $testObject->conditions( \@Conditions ) ;
180  
181 0 $testObject->preTest_conditions( \@preTestConditions ) ;
182 0 $testObject->test_conditions( \@testConditions ) ;
183 0 $testObject->postTest_conditions( \@postTestConditions ) ;
184  
185 0 ▶ if ( scalar(@preTestConditions)) { $$rh_testSetActions{$testObject->testName() . "_PretestAction"} = 1 ; } ;
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @preTestConditions) 0 0 0
186 0 ▶ if ( scalar(@testConditions)) { $$rh_testSetActions{$testObject->testName() . "_TestAction"} = 1 ; } ;
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @testConditions) 0 0 0
187 0 ▶ if ( scalar(@postTestConditions)) { $$rh_testSetActions{$testObject->testName() . "_PosttestAction"} = 1 ; } ;
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @postTestConditions) 0 0 0
188  
189 0 return $testObject ;
190
191 }
192  
193  
194 sub gatherTestSetConditions {
195  
196 0 ▶ my $self = shift or croak 'no self' ;
Subroutine gatherTestSetConditions: not called CC=8 SCAR=42.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
197 0 ▶ my $testConditions = shift or croak 'no conditions' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testConditions = shift() or croak("no conditions") 0 0 0
198 #print Dumper $testConditions ;
199  
200 0 my @testGlobalConditions = () ;
201  
202  
203 0 ▶ if ( ref( $testConditions ) eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $testConditions eq 'HASH') { } 0 0 0
elsif (ref $testConditions eq 'ARRAY') { } 0 0 0
204 0 my $testCondition = $testConditions ;
205 0 ▶ return (\@testGlobalConditions) if not exists $$testCondition{TestConditionType};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $testCondition->{"TestConditionType"} 0 0 0
206  
207 0 my $testConditionObject = $self->createTestCondition($testCondition) ;
208 0 push @testGlobalConditions, $testConditionObject ;
209  
210 }
211 elsif ( ref($testConditions) eq 'ARRAY' ) {
212 0 ▶ return (\@testGlobalConditions) if scalar(@$testConditions) == 0 ;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @$testConditions == 0 0 0 0
213  
214 0 foreach my $testCondition (@$testConditions) {
215 0 my $testConditionObject = $self->createTestCondition($testCondition) ;
216 0 push @testGlobalConditions, $testConditionObject ;
217  
218 }
219 }
220  
221 0 return (\@testGlobalConditions) ;
222 }
223  
224  
225  
226 sub createTestCondition {
227  
228 0 ▶ local $_ = undef ;
Subroutine createTestCondition: not called CC=3 SCAR=24.8
Pod undocumented
229 0 ▶ my $self = shift or croak 'no self' ;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
230 0 ▶ my $testCondition = shift or croak 'no test condition' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testCondition = shift() or croak("no test condition") 0 0 0
231  
232 0 ( my $testconditiontype = $$testCondition{TestConditionType} ) =~ s{^\s*(.*?)\s*$}{$1}x;
233  
234 0 my @other_keys = grep {$_ ne 'TestConditionType' } keys %{$testCondition} ;
235 0 my %constructor = map { ( my $key = uc($_) ) =~ s{TEST}{}x;
236 0 ( my $val = $$testCondition{$_} ) =~ s{^\s*(.*?)\s*$}{$1}x;
237 0 $key => $val ;
238 }
239 @other_keys ;
240 0 $constructor{TESTCONDITIONTYPE} = $testconditiontype ;
241 0 my $testConditionObject = VSGDR::UnitTest::TestSet::Test::TestCondition->make(\%constructor) ;
242  
243 0 return $testConditionObject ;
244  
245 }
246  
247  
248 sub gatherConditions {
249 0 ▶ my $self = shift or croak 'no self' ;
Subroutine gatherConditions: not called CC=6 SCAR=37.4
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
250 0 my $testConditions = shift ;
251 0 my @resultTestConditions = () ;
252  
253 0 ▶ return @resultTestConditions unless defined $testConditions ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $testConditions 0 0 0
254  
255 0 ▶ if ( ref( $testConditions ) eq 'HASH' ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $testConditions eq 'HASH') { } 0 0 0
elsif (ref $testConditions eq 'ARRAY') { } 0 0 0
256 0 my $testCondition = $testConditions ;
257 0 my $testConditionObject = $self->createTestCondition($testCondition) ;
258 0 push @resultTestConditions, $testConditionObject ;
259 }
260 elsif ( ref($testConditions) eq 'ARRAY' ) {
261 0 foreach my $testCondition (@$testConditions) {
262 0 my $testConditionObject = $self->createTestCondition($testCondition) ;
263 0 push @resultTestConditions, $testConditionObject ;
264 }
265 }
266 0 return @resultTestConditions ;
267 }
268  
269  
270 sub representationType {
271 0 ▶ my $self = shift;
Subroutine representationType: not called CC=1 SCAR=6.9
Pod undocumented
272 0 return 'XML' ;
273 }
274  
275 sub deparse {
276 0 ▶ my $self = shift or croak 'no self' ;
Subroutine deparse: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
277 0 ▶ my $testSet = shift or croak 'no test' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testSet = shift() or croak("no test") 0 0 0
278  
279 0 my $p1 = ' ';
280 0 my $p2 = ' ';
281 0 my $p3 = ' ';
282 0 my $p4 = ' ';
283  
284 #warn Dumper $testSet;
285 #print Dumper $ast ;
286 #print Dumper keys %$ast;
287 #exit ;
288  
289 0 return $self->xmlHeader() .
290 $self->xmlGlobals($testSet) .
291 "${p1}<TestGlobalConditions>\n" .
292 $self->xmlGlobalConditions($testSet) .
293 "${p1}</TestGlobalConditions>\n" .
294 $self->xmlTests($testSet) .
295 $self->xmlFooter() ;
296  
297 }
298  
299  
300 sub xmlHeader {
301 0 ▶ my $self = shift or croak 'no self' ;
Subroutine xmlHeader: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
302 0 return <<"EOH";
303 <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
304 <ROOT xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
305 EOH
306 }
307  
308 sub xmlFooter {
309 0 ▶ my $self = shift or croak 'no self' ;
Subroutine xmlFooter: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
310 0 return <<"EOF";
311 </ROOT>
312 EOF
313 }
314  
315 sub xmlGlobals {
316 0 ▶ my $self = shift or croak 'no self' ;
Subroutine xmlGlobals: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
317 0 ▶ my $testSet = shift or croak 'no testSet' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testSet = shift() or croak("no testSet") 0 0 0
318  
319  
320 0 my $p1 = ' ';
321 0 my $p2 = ' ';
322  
323 0 return "${p1}<TestGlobals>\n" .
324 "${p2}<TestNameSpace>" . $testSet->nameSpace() ."</TestNameSpace>\n" .
325 "${p2}<TestClass>". $testSet->className() ."</TestClass>\n" .
326 "${p2}<TestInitializeAction>". $testSet->initializeActionLiteral() ."</TestInitializeAction>\n" .
327 "${p2}<TestCleanupAction>". $testSet->cleanupActionLiteral() ."</TestCleanupAction>\n" .
328 "${p1}</TestGlobals>\n" ;
329 }
330  
331  
332 sub xmlGlobalConditions {
333 0 ▶ local $_ = undef;
Subroutine xmlGlobalConditions: not called CC=11 SCAR=48.8
Pod undocumented
334 0 ▶ my $self = shift or croak 'no self' ;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
335 0 ▶ my $testSet = shift or croak 'no testSet' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testSet = shift() or croak("no testSet") 0 0 0
336 0 my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ;
337 0 my @tests = @$ra_tests;
338 0 my $ra_cleanupConditions = $testSet->cleanupConditions();
339 0 my $ra_initializeConditions = $testSet->initializeConditions();
340 0 my @cleanupConditions = @{$ra_cleanupConditions} ;
341 0 my @initializeConditions = @{$ra_initializeConditions} ;
342 #warn Dumper $testSet ;
343 0 my $res = "" ;
344
345 0 my $p1 = ' ';
346 0 my $p2 = ' ';
347 0 my $p3 = ' ';
348 0 my $p4 = ' ';
349 0 my $p5 = ' ';
350 0 my $p6 = ' ';
351 0 my $p7 = ' ';
352 0 my $p8 = ' ';
353 0 my $p9 = ' ';
354  
355  
356 0 ▶ if ($testSet->initializeAction() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($testSet->initializeAction) 0 0 0
357 0 $res .= "${p2}<TestInitializeAction>". $testSet->initializeAction() ."</TestInitializeAction>\n" ;
358 0 $res .= "${p3}<TestInitializeConditions>\n" ;
359 0 foreach my $condition (@initializeConditions) {
360 0 $res .= "${p4}<TestInitializeCondition>\n" ;
361 0 $res .= "${p5}<TestConditionType>" . $condition->testConditionType() . "</TestConditionType>\n" ;
362 0 foreach my $attr ($condition->testConditionAttributes()) {
363 0 ( my $UC_attr = $attr ) =~ s{^(.)}{\U${1}}x;
364 0 ▶ $UC_attr = 'Test' . $UC_attr if $UC_attr !~ m{^Test}ix ;
Branch: 1 branch
BranchTrueFalseTotal
unless $UC_attr =~ /^Test/xi 0 0 0
365 0 $res .= "${p5}<${UC_attr}>" . $condition->${attr}() . "</${UC_attr}>\n" ;
366 }
367 0 $res .= "${p4}</TestInitializeCondition>\n" ;
368 }
369 0 $res .= "${p3}</TestInitializeConditions>\n" ;
370 }
371 0 ▶ if ($testSet->cleanupAction() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($testSet->cleanupAction) 0 0 0
372 0 $res .= "${p2}<TestCleanupAction>". $testSet->cleanupAction() ."</TestCleanupAction>\n" ;
373 0 $res .= "${p3}<TestCleanupConditions>\n" ;
374 0 foreach my $condition (@cleanupConditions ) {
375 0 $res .= "${p4}<TestCleanupCondition>\n" ;
376 0 $res .= "${p5}<TestConditionType>" . $condition->testConditionType() . "</TestConditionType>\n" ;
377 0 foreach my $attr ($condition->testConditionAttributes()) {
378 0 ( my $UC_attr = $attr ) =~ s{^(.)}{\U${1}}x;
379 0 ▶ $UC_attr = 'Test' . $UC_attr if $UC_attr !~ m{^Test}ix ;
Branch: 1 branch
BranchTrueFalseTotal
unless $UC_attr =~ /^Test/xi 0 0 0
380 0 $res .= "${p5}<${UC_attr}>" . $condition->${attr}() . "</${UC_attr}>\n" ;
381 }
382 0 $res .= "${p4}</TestCleanupCondition>\n" ;
383 }
384 0 $res .= "${p3}</TestCleanupConditions>\n" ;
385 }
386  
387 0 return $res;
388  
389 }
390  
391 sub xmlTests {
392  
393 0 ▶ local $_ = undef;
Subroutine xmlTests: not called CC=16 SCAR=56.1
Pod undocumented
394 0 ▶ my $self = shift or croak 'no self' ;
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("no self") 0 0 0
395 0 ▶ my $testSet = shift or croak 'no testSet' ;
Branch: 1 branch
BranchTrueFalseTotal
my $testSet = shift() or croak("no testSet") 0 0 0
396 0 my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ;
397 0 my @tests = @$ra_tests;
398 0 my $ra_cleanupConditions = $testSet->cleanupConditions();
399 0 my $ra_initializeConditions = $testSet->initializeConditions();
400 0 my @cleanupConditions = @{$ra_cleanupConditions} ;
401 0 my @initializeConditions = @{$ra_initializeConditions} ;
402  
403 0 my $p1 = ' ';
404 0 my $p2 = ' ';
405 0 my $p3 = ' ';
406 0 my $p4 = ' ';
407 0 my $p5 = ' ';
408 0 my $p6 = ' ';
409 0 my $p7 = ' ';
410 0 my $p8 = ' ';
411 0 my $p9 = ' ';
412  
413 0 my $res = "${p1}<Tests>\n" ;
414  
415 0 my $rh_actions = $testSet->actions();
416 0 my %actions = %{$rh_actions} ;
417 0 my %Usedactions = ();
418  
419 0 foreach my $test (@tests) {
420  
421 0 $res .= "${p3}<Test>\n" ;
422 0 $res .= "${p4}<TestName>".$test->testName()."</TestName>\n" ;
423 0 $res .= "${p4}<TestActions>\n" ;
424 0 $res .= "${p5}<TestActionData>\n" ;
425 0 $res .= "${p6}<TestActionDataName>".$test->testActionDataName()."</TestActionDataName>\n" ;
426 0 $res .= "${p6}<PretestAction>".$test->preTestAction()."</PretestAction>\n" ;
427 0 $res .= "${p7}<PretestConditions>\n" ;
428  
429 0 ▶ if ( $test->preTestAction() !~ m{^null|nothing$}ix ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($test->preTestAction =~ /^null|nothing$/xi) 0 0 0
430 0 my $conditions = $test->preTest_conditions() ;
431 #print Dumper $conditions;
432 0 foreach my $condition (@$conditions) {
433 0 $res .= "${p8}<TestCondition>\n" ;
434 0 $res .= "${p9}<TestConditionType>" . $condition->testConditionType() . "</TestConditionType>\n" ;
435 0 foreach my $attr ($condition->testConditionAttributes()) {
436 0 ( my $UC_attr = $attr ) =~ s{^(.)}{\U${1}}x;
437 0 ▶ $UC_attr = 'Test' . $UC_attr if $UC_attr !~ m{^Test}ix ;
Branch: 1 branch
BranchTrueFalseTotal
unless $UC_attr =~ /^Test/xi 0 0 0
438 0 $res .= "${p9}<${UC_attr}>" . $condition->${attr}() . "</${UC_attr}>\n" ;
439 }
440 0 $res .= "${p8}</TestCondition>\n" ;
441 }
442 0 $Usedactions{$test->preTestAction()}{PROCESSED} = 1;
443 }
444 0 $res .= "${p7}</PretestConditions>\n" ;
445  
446 0 $res .= "${p6}<TestAction>".$test->testAction()."</TestAction>\n" ;
447 0 $res .= "${p7}<TestConditions>\n";
448 0 ▶ if ( $test->testAction() !~ m{^null|nothing$}ix ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($test->testAction =~ /^null|nothing$/xi) 0 0 0
449 0 my $conditions = $test->test_conditions() ;
450 0 foreach my $condition (@$conditions) {
451 0 $res .= "${p8}<TestCondition>\n" ;
452 0 $res .= "${p9}<TestConditionType>" . $condition->testConditionType() . "</TestConditionType>\n" ;
453 0 foreach my $attr ($condition->testConditionAttributes()) {
454 0 ( my $UC_attr = $attr ) =~ s{^(.)}{\U${1}}x;
455 0 ▶ $UC_attr = 'Test' . $UC_attr if $UC_attr !~ m{^Test}ix ;
Branch: 1 branch
BranchTrueFalseTotal
unless $UC_attr =~ /^Test/xi 0 0 0
456 0 $res .= "${p9}<${UC_attr}>" . $condition->${attr}() . "</${UC_attr}>\n" ;
457 }
458 0 $res .= "${p8}</TestCondition>\n" ;
459 }
460 0 $Usedactions{$test->testAction()}{PROCESSED} = 1;
461 }
462 0 $res .= "${p7}</TestConditions>\n" ;
463  
464 0 $res .= "${p6}<PosttestAction>".$test->postTestAction()."</PosttestAction>\n" ;
465 0 $res .= "${p7}<PosttestConditions>\n";
466 0 ▶ if ( $test->postTestAction() !~ m{^null|nothing$}ix ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($test->postTestAction =~ /^null|nothing$/xi) 0 0 0
467 0 my $conditions = $test->postTest_conditions() ;
468 0 foreach my $condition (@$conditions) {
469 0 $res .= "${p8}<TestCondition>\n" ;
470 0 $res .= "${p9}<TestConditionType>" . $condition->testConditionType() . "</TestConditionType>\n" ;
471
472 0 foreach my $attr ($condition->testConditionAttributes()) {
473 0 ( my $UC_attr = $attr ) =~ s{^(.)}{\U${1}}x;
474 0 ▶ $UC_attr = 'Test' . $UC_attr if $UC_attr !~ m{^Test}ix ;
Branch: 1 branch
BranchTrueFalseTotal
unless $UC_attr =~ /^Test/xi 0 0 0
475 0 $res .= "${p9}<${UC_attr}>" . $condition->${attr}() . "</${UC_attr}>\n" ;
476 }
477 0 $res .= "${p8}</TestCondition>\n" ;
478 }
479 0 $Usedactions{$test->postTestAction()}{PROCESSED} = 1;
480 }
481 0 $res .= "${p7}</PosttestConditions>\n";
482 0 $res .= "${p5}</TestActionData>\n" ;
483  
484 0 $res .= "${p4}</TestActions>\n" ;
485 0 $res .= "${p3}</Test>\n" ;
486  
487 0 } $res .= "${p1}</Tests>\n" ;
488  
489 0 return $res;
490 }
491  
492  
493 0 ▶sub flatten { return map {@$_} @_ } ;
Subroutine flatten: not called CC=1 SCAR=6.9
Pod undocumented
494  
495 1 1 ;
496  
497 __DATA__
« lib/VSGDR/UnitTest/TestSet/Representation/XLS.pm ↑ Summary lib/VSGDR/UnitTest/TestSet/Representation/NET/VB.pm »