-
Notifications
You must be signed in to change notification settings - Fork 0
/
Web TestSetFunctions.bas
2017 lines (1821 loc) · 85.7 KB
/
Web TestSetFunctions.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Attribute VB_Name = "TestSetFunctions"
Public Function GetTestsByFunctionalArea()
Dim iCount As Integer
Dim iTotCount As Integer
iCount = 0
iTotCount = 0
' Count the critical defects by test phase and add them to the data sheet.
arrTestPhaseKeys = CountTestsByFunctionalArea()
If UBound(arrTestPhaseKeys) <= 0 Then
Exit Function
End If
' Open the template file
Set mySource = fso.OpenTextFile(strTemplatePath & "TestFunctionalAreaTemplate.txt", ForReading)
Set myDest = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestFunctionalArea.aspx", ForWriting, True)
Do While mySource.AtEndOfStream <> True
rc = mySource.ReadLine
If InStr(1, rc, "PassedPoints") > 0 Then
' Loop round our array
For i = 0 To UBound(arrTestPhaseKeys)
' Split the file
mySplit = Split(arrTestPhaseKeys(i), "|")
If mySplit(0) = "Passed" Then
' Write the values
myDest.WriteLine "<DCWC:DataPoint YValues=" & Chr(34) & objTestFunctionalAreaDictionary(arrTestPhaseKeys(i)) & Chr(34) & " AxisLabel=" & Chr(34) & mySplit(1) & Chr(34) & " />"
End If
Next
Else
If InStr(1, rc, "FailedPoints") > 0 Then
' Loop round our array
For i = 0 To UBound(arrTestPhaseKeys)
' Split the file
mySplit = Split(arrTestPhaseKeys(i), "|")
If mySplit(0) = "Failed" Then
' Write the values
myDest.WriteLine "<DCWC:DataPoint YValues=" & Chr(34) & objTestFunctionalAreaDictionary(arrTestPhaseKeys(i)) & Chr(34) & " AxisLabel=" & Chr(34) & mySplit(1) & Chr(34) & " />"
End If
Next
Else
If InStr(1, rc, "NotCompletedPoints") > 0 Then
' Loop round our array
For i = 0 To UBound(arrTestPhaseKeys)
' Split the file
mySplit = Split(arrTestPhaseKeys(i), "|")
If mySplit(0) = "Not Completed" Then
' Write the values
myDest.WriteLine "<DCWC:DataPoint YValues=" & Chr(34) & objTestFunctionalAreaDictionary(arrTestPhaseKeys(i)) & Chr(34) & " AxisLabel=" & Chr(34) & mySplit(1) & Chr(34) & " />"
End If
Next
Else
If InStr(1, rc, "NoRunPoints") > 0 Then
' Loop round our array
For i = 0 To UBound(arrTestPhaseKeys)
' Split the file
mySplit = Split(arrTestPhaseKeys(i), "|")
If mySplit(0) = "No Run" Then
' Write the values
myDest.WriteLine "<DCWC:DataPoint YValues=" & Chr(34) & objTestFunctionalAreaDictionary(arrTestPhaseKeys(i)) & Chr(34) & " AxisLabel=" & Chr(34) & mySplit(1) & Chr(34) & " />"
End If
Next
Else
myDest.WriteLine rc
End If
End If
End If
End If
Loop
' Close the files
myDest.Close
mySource.Close
' See how many functional areas we've got in the dictionary and this will determine the size of the graph
myTemp = ""
For Each Ele In arrTestPhaseKeys
mySplit = Split(Ele, "|")
If mySplit(0) = "Passed" Then
If myTemp = "" Or myTemp <> mySplit(1) Then
myTemp = mySplit(1)
iCount = iCount + 1
End If
End If
Next
myTemp = ""
For Each Ele In arrTestPhaseKeys
iTotCount = iTotCount + objTestFunctionalAreaDictionary(Ele)
Next
' Open the file and change the width value
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestFunctionalArea.aspx", ForReading)
strText = myFile.ReadAll
myFile.Close
' Depending on the number, change the value
Select Case iCount
Case 1, 2, 3
strText = Replace(strText, "SetWidth", Chr(34) & "75" & Chr(34))
Case 4, 5, 6
strText = Replace(strText, "SetWidth", Chr(34) & "80" & Chr(34))
Case Else
strText = Replace(strText, "SetWidth", Chr(34) & "100" & Chr(34))
End Select
Select Case iTotCount
Case 1, 2, 3, 4, 5, 6, 7, 8, 9
strText = Replace(strText, "ReplaceYAxis", "Interval=" & Chr(34) & "1" & Chr(34))
Case Else
strText = Replace(strText, "ReplaceYAxis", "")
End Select
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestFunctionalArea.aspx", ForWriting, True)
myFile.WriteLine strText
myFile.Close
' Create the supporting test set page and include the graph just created
Set myFile = fso.OpenTextFile(strTemplatePath & "TestSetDetailsTemplate.txt", ForReading)
strText = myFile.ReadAll
myFile.Close
' Replace the graph
strText = Replace(strText, "TestsByFunctionalArea", Chr(34) & strTheWebPath & strFolderDate & "/" & strPathandFileName & "-TestFunctionalArea.aspx" & Chr(34))
strText = Replace(strText, "strHeader", "Supporting Test Script Details for " & strHeader)
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestSetDetails.asp", ForWriting, True)
myFile.WriteLine strText
myFile.Close
' Copy the hyperlink table file to the folder
fso.CopyFile strTemplatePath & "TestFunctionalAreaTableTemplate.txt", strFolderPath & strPathandFileName & "-TestFunctionalAreaTable.asp"
' Now do the hyperlink table
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestFunctionalAreaTable.asp", ForAppending)
myTemp = ""
For i = 0 To UBound(arrTestPhaseKeys)
' Split the file
mySplit = Split(arrTestPhaseKeys(i), "|")
If mySplit(0) = "Failed" Then
If myTemp = "" Or myTemp <> mySplit(1) Then
myTemp = mySplit(1)
myFile.WriteLine "<tr><td>" & mySplit(1) & "</td><td>" & objTestFunctionalAreaDictionary("Passed|" & mySplit(1)) & "</td><td>" & objTestFunctionalAreaDictionary(arrTestPhaseKeys(i)) & "</td><td>" & objTestFunctionalAreaDictionary("Not Completed|" & mySplit(1)) & "</td><td>" & objTestFunctionalAreaDictionary("No Run|" & mySplit(1)) & "</td></tr>"
End If
Else
Exit For
End If
Next
' Finish off html
myFile.WriteLine "</table></table></body></html>"
myFile.Close
End Function
Public Function GetTestSets()
Dim intPlannedCount As Integer, intActualCount As Integer, intPassedCount As Integer, intFailedCount As Integer, intNCCount As Integer, intReRun As Integer
Dim arrStatus As Variant
' Set up the new dictionary
Set objTestSetDictionary = New Dictionary
' Get Total number of tests planned
intPlannedCount = 0
intPlannedCount = CountTestsRunByDate("Planned-Baseline", "")
objTestSetDictionary.Add "Total No Scripts", intPlannedCount
' Set the total planned global variable
intTotalPlannedTests = intPlannedCount
If intTotalPlannedTests = 0 Then
' See if test set status file exists
If fso.FileExists(strFolderPath & strPathandFileName & "-TestSetStatusStage1.txt") = True Then
' Delete it
fso.DeleteFile strFolderPath & strPathandFileName & "-TestSetStatusStage1.txt", True
End If
' Create it again, from the error template
fso.CopyFile strTemplatePath & "TestSetsMissingTemplate.txt", strFolderPath & strPathandFileName & "-TestSetStatusStage1.txt"
' Open the file to read the data
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestSetStatusStage1.txt", ForReading)
strText = myFile.ReadAll
myFile.Close
' Change the header
strText = Replace(strText, "strHeader", "No Test Script data for " & strHeader)
' Write the data outr
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-TestSetStatusStage1.txt", ForWriting, True)
myFile.WriteLine strText
myFile.Close
' Set the don't run flag
blnDontRun = True
blnNoTestSets = True
Exit Function
End If
' Set blnNoTestSets to false if we're here
blnNoTestSets = False
' Get the Total number of tests passed
intPassedCount = 0
intPassedCount = CountTestsRunByDate("Status", "", "Passed")
objTestSetDictionary.Add "Total Passed", intPassedCount
' Get the Total number of tests failed
intFailedCount = 0
intFailedCount = CountTestsRunByDate("Status", "", "Failed")
objTestSetDictionary.Add "Total Failed", intFailedCount
' Get the Total number of tests Not Completed
intNCCount = 0
intNCCount = CountTestsRunByDate("Status", "", "Not Completed")
objTestSetDictionary.Add "Total Not Completed", intNCCount
' Get the Total number of tests Not Run
intNRCount = 0
intNRCount = CountTestsRunByDate("Status", "", "No Run")
objTestSetDictionary.Add "Total No Run", intNRCount
' Calculate the executed value
intExecuted = 0
intExecuted = intPassedCount + intFailedCount
objTestSetDictionary.Add "Total Executed", intExecuted
' Now calculate the percentage values
If intTotalPlannedTests = 0 Then
iNoRunPercent = "0"
iExecutedPercent = "0"
iPassedPercent = "0"
iFailedPercent = "0"
iNCPercent = "0"
iTotalPercent = "0"
iExecutedPassed = "0"
iExecutedFailed = "0"
iExecutedNC = "0"
Else
iNoRunPercent = Round(intNRCount / intTotalPlannedTests * 100, 2)
iExecutedPercent = Round(intExecuted / intTotalPlannedTests * 100, 2)
iPassedPercent = Round(intPassedCount / intTotalPlannedTests * 100, 2)
iFailedPercent = Round(intFailedCount / intTotalPlannedTests * 100, 2)
iNCPercent = Round(intNCCount / intTotalPlannedTests * 100, 2)
iTotalPercent = iNoRunPercent + iExecutedPercent
If intPassedCount > 0 And intExecuted > 0 Then
iExecutedPassed = Round(intPassedCount / intExecuted * 100, 2)
Else
iExecutedPassed = "0"
End If
If intFailedCount > 0 And intExecuted > 0 Then
iExecutedFailed = Round(intFailedCount / intExecuted * 100, 2)
Else
iExecutedFailed = "0"
End If
If intNCCount > 0 And intExecuted > 0 Then
iExecutedNC = Round(intNCCount / intExecuted * 100, 2)
Else
iExecutedNC = "0"
End If
End If
dblGlobalExecutedPercent = iExecutedPercent
dblGlobalPlannedPassedPercent = iPassedPercent
dblGlobalPlannedFailedPercent = iFailedPercent
dblGlobalExecutedPassedPercent = iExecutedPassed
dblGlobalExecutedFailedPercent = iExecutedFailed
' Get the Priority details
intPlannedP1 = CountTestsRunByDate("Planned-Priority", "", "", "1-Urgent")
intPlannedP2 = CountTestsRunByDate("Planned-Priority", "", "", "2-High")
intPlannedP3 = CountTestsRunByDate("Planned-Priority", "", "", "3-Medium")
intPlannedP4 = CountTestsRunByDate("Planned-Priority", "", "", "4-Low")
objTestSetDictionary.Add "Planned Priority 1", intPlannedP1
objTestSetDictionary.Add "Planned Priority 2", intPlannedP2
objTestSetDictionary.Add "Planned Priority 3", intPlannedP3
objTestSetDictionary.Add "Planned Priority 4", intPlannedP4
intPassedP1 = CountTestsRunByDate("Status-Priority", "", "Passed", "1-Urgent")
intPassedP2 = CountTestsRunByDate("Status-Priority", "", "Passed", "2-High")
intPassedP3 = CountTestsRunByDate("Status-Priority", "", "Passed", "3-Medium")
intPassedP4 = CountTestsRunByDate("Status-Priority", "", "Passed", "4-Low")
objTestSetDictionary.Add "Passed Priority 1", intPassedP1
objTestSetDictionary.Add "Passed Priority 2", intPassedP2
objTestSetDictionary.Add "Passed Priority 3", intPassedP3
objTestSetDictionary.Add "Passed Priority 4", intPassedP4
intFailedP1 = CountTestsRunByDate("Status-Priority", "", "Failed", "1-Urgent")
intFailedP2 = CountTestsRunByDate("Status-Priority", "", "Failed", "2-High")
intFailedP3 = CountTestsRunByDate("Status-Priority", "", "Failed", "3-Medium")
intFailedP4 = CountTestsRunByDate("Status-Priority", "", "Failed", "4-Low")
objTestSetDictionary.Add "Failed Priority 1", intFailedP1
objTestSetDictionary.Add "Failed Priority 2", intFailedP2
objTestSetDictionary.Add "Failed Priority 3", intFailedP3
objTestSetDictionary.Add "Failed Priority 4", intFailedP4
intNCP1 = CountTestsRunByDate("Status-Priority", "", "Not Completed", "1-Urgent")
intNCP2 = CountTestsRunByDate("Status-Priority", "", "Not Completed", "2-High")
intNCP3 = CountTestsRunByDate("Status-Priority", "", "Not Completed", "3-Medium")
intNCP4 = CountTestsRunByDate("Status-Priority", "", "Not Completed", "4-Low")
objTestSetDictionary.Add "Not Completed Priority 1", intNCP1
objTestSetDictionary.Add "Not Completed Priority 2", intNCP2
objTestSetDictionary.Add "Not Completed Priority 3", intNCP3
objTestSetDictionary.Add "Not Completed Priority 4", intNCP4
intNRP1 = CountTestsRunByDate("Status-Priority", "", "No Run", "1-Urgent")
intNRP2 = CountTestsRunByDate("Status-Priority", "", "No Run", "2-High")
intNRP3 = CountTestsRunByDate("Status-Priority", "", "No Run", "3-Medium")
intNRP4 = CountTestsRunByDate("Status-Priority", "", "No Run", "4-Low")
objTestSetDictionary.Add "No Run Priority 1", intNRP1
objTestSetDictionary.Add "No Run Priority 2", intNRP2
objTestSetDictionary.Add "No Run Priority 3", intNRP3
objTestSetDictionary.Add "No Run Priority 4", intNRP4
' Set up the executed priorities
objTestSetDictionary.Add "Executed Priority 1", intPassedP1 + intFailedP1
objTestSetDictionary.Add "Executed Priority 2", intPassedP2 + intFailedP2
objTestSetDictionary.Add "Executed Priority 3", intPassedP3 + intFailedP3
objTestSetDictionary.Add "Executed Priority 4", intPassedP4 + intFailedP4
' See if we've got no total planned tests
If intTotalPlannedTests = 0 Then
iP1Total = "0"
iP2Total = "0"
iP3Total = "0"
iP4Total = "0"
Else
' Calculate the priority percentages
iP1Total = Round(intPlannedP1 / intTotalPlannedTests * 100, 2)
iP2Total = Round(intPlannedP2 / intTotalPlannedTests * 100, 2)
iP3Total = Round(intPlannedP3 / intTotalPlannedTests * 100, 2)
iP4Total = Round(intPlannedP4 / intTotalPlannedTests * 100, 2)
End If
' See if we've got no priority planned
If intPlannedP1 = 0 Then
iP1NoRun = "0"
Else
iP1NoRun = Round(intNRP1 / intPlannedP1 * 100, 2)
End If
If intPlannedP2 = 0 Then
iP2NoRun = "0"
Else
iP2NoRun = Round(intNRP2 / intPlannedP2 * 100, 2)
End If
If intPlannedP3 = 0 Then
iP3NoRun = "0"
Else
iP3NoRun = Round(intNRP3 / intPlannedP3 * 100, 2)
End If
If intPlannedP4 = 0 Then
iP4NoRun = "0"
Else
iP4NoRun = Round(intNRP4 / intPlannedP4 * 100, 2)
End If
If intPlannedP1 = 0 Then
iP1Executed = "0"
Else
iP1Executed = Round((intPassedP1 + intFailedP1) / intPlannedP1 * 100, 2)
End If
If intPlannedP2 = 0 Then
iP2Executed = "0"
Else
iP2Executed = Round((intPassedP2 + intFailedP2) / intPlannedP2 * 100, 2)
End If
If intPlannedP3 = 0 Then
iP3Executed = "0"
Else
iP3Executed = Round((intPassedP3 + intFailedP3) / intPlannedP3 * 100, 2)
End If
If intPlannedP4 = 0 Then
iP4Executed = "0"
Else
iP4Executed = Round((intPassedP4 + intFailedP4) / intPlannedP4 * 100, 2)
End If
If (intPassedP1 + intFailedP1) = 0 Then
iP1Passed = "0"
Else
iP1Passed = Round(intPassedP1 / (intPassedP1 + intFailedP1) * 100, 2)
End If
If (intPassedP2 + intFailedP2) = 0 Then
iP2Passed = "0"
Else
iP2Passed = Round(intPassedP2 / (intPassedP2 + intFailedP2) * 100, 2)
End If
If (intPassedP3 + intFailedP3) = 0 Then
iP3Passed = "0"
Else
iP3Passed = Round(intPassedP3 / (intPassedP3 + intFailedP3) * 100, 2)
End If
If (intPassedP4 + intFailedP4) = 0 Then
iP4Passed = "0"
Else
iP4Passed = Round(intPassedP4 / (intPassedP4 + intFailedP4) * 100, 2)
End If
If (intPassedP1 + intFailedP1) = 0 Then
iP1Failed = "0"
Else
iP1Failed = Round(intFailedP1 / (intPassedP1 + intFailedP1) * 100, 2)
End If
If (intPassedP2 + intFailedP2) = 0 Then
iP2Failed = "0"
Else
iP2Failed = Round(intFailedP2 / (intPassedP2 + intFailedP2) * 100, 2)
End If
If (intPassedP3 + intFailedP3) = 0 Then
iP3Failed = "0"
Else
iP3Failed = Round(intFailedP3 / (intPassedP3 + intFailedP3) * 100, 2)
End If
If (intPassedP4 + intFailedP4) = 0 Then
iP4Failed = "0"
Else
iP4Failed = Round(intFailedP4 / (intPassedP4 + intFailedP4) * 100, 2)
End If
If (intPassedP1 + intFailedP1) = 0 Then
iP1NC = "0"
Else
iP1NC = Round(intNCP1 / (intPassedP1 + intFailedP1) * 100, 2)
End If
If (intPassedP2 + intFailedP2) = 0 Then
iP2NC = "0"
Else
iP2NC = Round(intNCP2 / (intPassedP2 + intFailedP2) * 100, 2)
End If
If (intPassedP3 + intFailedP3) = 0 Then
iP3NC = "0"
Else
iP3NC = Round(intNCP3 / (intPassedP3 + intFailedP3) * 100, 2)
End If
If (intPassedP4 + intFailedP4) = 0 Then
iP4NC = "0"
Else
iP4NC = Round(intNCP4 / (intPassedP4 + intFailedP4) * 100, 2)
End If
' Get the Total number of planned tests Today
intPlannedCount = 0
intPlannedCount = CountTestsRunByDate("Replanned", TodaysDate)
objTestSetDictionary.Add "Planned Today", intPlannedCount
' Get the Total number of tests passed Today
intPassedCount = 0
intPassedCount = CountTestsRunByDate("Status", TodaysDate, "Passed")
objTestSetDictionary.Add "Passed Today", intPassedCount
' Get the Total number of tests failed Today
intFailedCount = 0
intFailedCount = CountTestsRunByDate("Status", TodaysDate, "Failed")
objTestSetDictionary.Add "Failed Today", intFailedCount
' Get the Total number of tests Not Completed Today
intNCCount = 0
intNCCount = CountTestsRunByDate("Status", TodaysDate, "Not Completed")
objTestSetDictionary.Add "Not Completed Today", intNCCount
' Get the Total number of tests Not Run Today
intNRCount = 0
intNRCount = CountTestsRunByDate("Status", TodaysDate, "No Run Daily")
objTestSetDictionary.Add "No Run Today", intNRCount
' Set up the Executed value
objTestSetDictionary.Add "Executed Today", intFailedCount + intPassedCount
' Output the data
strWeekDay = GetWeekday(TodaysDate)
' Get this week's data
iWeekDay = Weekday(TodaysDate)
Select Case iWeekDay
Case 2
dateThisWeek = TodaysDate
Case 3
dateThisWeek = DateAdd("d", -1, TodaysDate)
Case 4
dateThisWeek = DateAdd("d", -2, TodaysDate)
Case 5
dateThisWeek = DateAdd("d", -3, TodaysDate)
Case 6
dateThisWeek = DateAdd("d", -4, TodaysDate)
End Select
' Get the start weekday
strStartWeekday = GetWeekday(dateThisWeek)
' Get the Total number of test planned this week
intPlannedCount = 0
intPlannedCount = CountTestsRunByDate("Replanned", ">= " & dateThisWeek & " And <=" & TodaysDate)
objTestSetDictionary.Add "Planned Week", intPlannedCount
' Get the Total number of tests passed this week
intPassedCount = 0
intPassedCount = CountTestsRunByDate("Status", ">= " & dateThisWeek & " And <=" & TodaysDate, "Passed")
objTestSetDictionary.Add "Passed Week", intPassedCount
' Get the Total number of tests failed this week
intFailedCount = 0
intFailedCount = CountTestsRunByDate("Status", ">= " & dateThisWeek & " And <=" & TodaysDate, "Failed")
objTestSetDictionary.Add "Failed Week", intFailedCount
' Get the Total number of tests Not Completed this week
intNCCount = 0
intNCCount = CountTestsRunByDate("Status", ">= " & dateThisWeek & " And <=" & TodaysDate, "Not Completed")
objTestSetDictionary.Add "Not Completed Week", intNCCount
' Get the Total number of tests Not Run this week
intNRCount = 0
intNRCount = CountTestsRunByDate("Status", ">= " & dateThisWeek & " And <=" & TodaysDate, "No Run Weekly")
objTestSetDictionary.Add "No Run Week", intNRCount
' Calculate executed week
objTestSetDictionary.Add "Executed Week", intFailedCount + intPassedCount
' Open the template file
Set myFile = fso.OpenTextFile(strTemplatePath & "TestSetStatusTemplate.txt", ForReading)
' Get the text
strText = myFile.ReadAll
' Close this file
myFile.Close
' Start Replacing the text in the file
strNewText = Replace(strText, "strHeader", strHeader)
strNewText = Replace(strNewText, "TotalNoScripts", objTestSetDictionary.Item("Total No Scripts"))
strNewText = Replace(strNewText, "iTotalPercent", iTotalPercent)
strNewText = Replace(strNewText, "TotalNoRun", objTestSetDictionary.Item("Total No Run"))
strNewText = Replace(strNewText, "iNoRunPercent", iNoRunPercent)
strNewText = Replace(strNewText, "TotalExecuted", objTestSetDictionary.Item("Total Executed"))
strNewText = Replace(strNewText, "iExecutedPercent", iExecutedPercent)
strNewText = Replace(strNewText, "TotalPassed", objTestSetDictionary.Item("Total Passed"))
strNewText = Replace(strNewText, "iPassedPercent", iPassedPercent)
strNewText = Replace(strNewText, "iExecutedPassed", iExecutedPassed)
strNewText = Replace(strNewText, "TotalFailed", objTestSetDictionary.Item("Total Failed"))
strNewText = Replace(strNewText, "iFailedPercent", iFailedPercent)
strNewText = Replace(strNewText, "iExecutedFailed", iExecutedFailed)
strNewText = Replace(strNewText, "TotalNotCompleted", objTestSetDictionary.Item("Total Not Completed"))
strNewText = Replace(strNewText, "iNCPercent", iNCPercent)
strNewText = Replace(strNewText, "iExecutedNC", iExecutedNC)
strNewText = Replace(strNewText, "strWeekday", strWeekDay)
strNewText = Replace(strNewText, "TodaysDate", TodaysDate)
strNewText = Replace(strNewText, "PlannedToday", objTestSetDictionary.Item("Planned Today"))
strNewText = Replace(strNewText, "NoRunToday", objTestSetDictionary.Item("No Run Today"))
strNewText = Replace(strNewText, "ExecutedToday", objTestSetDictionary.Item("Executed Today"))
strNewText = Replace(strNewText, "PassedToday", objTestSetDictionary.Item("Passed Today"))
strNewText = Replace(strNewText, "FailedToday", objTestSetDictionary.Item("Failed Today"))
strNewText = Replace(strNewText, "NotCompletedToday", objTestSetDictionary.Item("Not Completed Today"))
strNewText = Replace(strNewText, "strStartWeekday", strStartWeekday)
strNewText = Replace(strNewText, "dateThisWeek", dateThisWeek)
strNewText = Replace(strNewText, "PlannedWeek", objTestSetDictionary.Item("Planned Week"))
strNewText = Replace(strNewText, "NoRunWeek", objTestSetDictionary.Item("No Run Week"))
strNewText = Replace(strNewText, "ExecutedWeek", objTestSetDictionary.Item("Executed Week"))
strNewText = Replace(strNewText, "PassedWeek", objTestSetDictionary.Item("Passed Week"))
strNewText = Replace(strNewText, "FailedWeek", objTestSetDictionary.Item("Failed Week"))
strNewText = Replace(strNewText, "NotCompletedWeek", objTestSetDictionary.Item("Not Completed Week"))
strNewText = Replace(strNewText, "PlannedPriority1", objTestSetDictionary.Item("Planned Priority 1"))
strNewText = Replace(strNewText, "PlannedPriority2", objTestSetDictionary.Item("Planned Priority 2"))
strNewText = Replace(strNewText, "PlannedPriority3", objTestSetDictionary.Item("Planned Priority 3"))
strNewText = Replace(strNewText, "PlannedPriority4", objTestSetDictionary.Item("Planned Priority 4"))
strNewText = Replace(strNewText, "iP1Total", iP1Total)
strNewText = Replace(strNewText, "iP2Total", iP2Total)
strNewText = Replace(strNewText, "iP3Total", iP3Total)
strNewText = Replace(strNewText, "iP4Total", iP4Total)
strNewText = Replace(strNewText, "NoRunPriority1", objTestSetDictionary.Item("No Run Priority 1"))
strNewText = Replace(strNewText, "NoRunPriority2", objTestSetDictionary.Item("No Run Priority 2"))
strNewText = Replace(strNewText, "NoRunPriority3", objTestSetDictionary.Item("No Run Priority 3"))
strNewText = Replace(strNewText, "NoRunPriority4", objTestSetDictionary.Item("No Run Priority 4"))
strNewText = Replace(strNewText, "iP1NoRun", iP1NoRun)
strNewText = Replace(strNewText, "iP2NoRun", iP2NoRun)
strNewText = Replace(strNewText, "iP3NoRun", iP3NoRun)
strNewText = Replace(strNewText, "iP4NoRun", iP4NoRun)
strNewText = Replace(strNewText, "ExecutedPriority1", objTestSetDictionary.Item("Executed Priority 1"))
strNewText = Replace(strNewText, "ExecutedPriority2", objTestSetDictionary.Item("Executed Priority 2"))
strNewText = Replace(strNewText, "ExecutedPriority3", objTestSetDictionary.Item("Executed Priority 3"))
strNewText = Replace(strNewText, "ExecutedPriority4", objTestSetDictionary.Item("Executed Priority 4"))
strNewText = Replace(strNewText, "iP1Executed", iP1Executed)
strNewText = Replace(strNewText, "iP2Executed", iP2Executed)
strNewText = Replace(strNewText, "iP3Executed", iP3Executed)
strNewText = Replace(strNewText, "iP4Executed", iP4Executed)
strNewText = Replace(strNewText, "PassedPriority1", objTestSetDictionary.Item("Passed Priority 1"))
strNewText = Replace(strNewText, "PassedPriority2", objTestSetDictionary.Item("Passed Priority 2"))
strNewText = Replace(strNewText, "PassedPriority3", objTestSetDictionary.Item("Passed Priority 3"))
strNewText = Replace(strNewText, "PassedPriority4", objTestSetDictionary.Item("Passed Priority 4"))
strNewText = Replace(strNewText, "iP1Passed", iP1Passed)
strNewText = Replace(strNewText, "iP2Passed", iP2Passed)
strNewText = Replace(strNewText, "iP3Passed", iP3Passed)
strNewText = Replace(strNewText, "iP4Passed", iP4Passed)
strNewText = Replace(strNewText, "FailedPriority1", objTestSetDictionary.Item("Failed Priority 1"))
strNewText = Replace(strNewText, "FailedPriority2", objTestSetDictionary.Item("Failed Priority 2"))
strNewText = Replace(strNewText, "FailedPriority3", objTestSetDictionary.Item("Failed Priority 3"))
strNewText = Replace(strNewText, "FailedPriority4", objTestSetDictionary.Item("Failed Priority 4"))
strNewText = Replace(strNewText, "iP1Failed", iP1Failed)
strNewText = Replace(strNewText, "iP2Failed", iP2Failed)
strNewText = Replace(strNewText, "iP3Failed", iP3Failed)
strNewText = Replace(strNewText, "iP4Failed", iP4Failed)
strNewText = Replace(strNewText, "NotCompletedPriority1", objTestSetDictionary.Item("Not Completed Priority 1"))
strNewText = Replace(strNewText, "NotCompletedPriority2", objTestSetDictionary.Item("Not Completed Priority 2"))
strNewText = Replace(strNewText, "NotCompletedPriority3", objTestSetDictionary.Item("Not Completed Priority 3"))
strNewText = Replace(strNewText, "NotCompletedPriority4", objTestSetDictionary.Item("Not Completed Priority 4"))
strNewText = Replace(strNewText, "iP1NC", iP1NC)
strNewText = Replace(strNewText, "iP2NC", iP2NC)
strNewText = Replace(strNewText, "iP3NC", iP3NC)
strNewText = Replace(strNewText, "iP4NC", iP4NC)
' Write the new text to the asp file
Set myFile = fso.OpenTextFile(strFolderPath & strPathandFileName & "-" & "TestSetStatusStage1.txt", ForWriting, True)
myFile.WriteLine strNewText
myFile.Close
' Write out the data for the Progress percentage graph
' Open the template file
Set mySource = fso.OpenTextFile(strTemplatePath & "TestPlannedProgressTemplate.txt", ForReading)
Set myDest = fso.OpenTextFile(strFolderPath & strPathandFileName & "-" & "TestPlannedProgress.aspx", ForWriting, True)
Do While mySource.AtEndOfStream <> True
rc = mySource.ReadLine
If InStr(1, rc, "PassedPoints") > 0 Then
' Write the values
myDest.WriteLine "<DCWC:DataPoint XValue=" & Chr(34) & "1" & Chr(34) & " YValues=" & Chr(34) & iPassedPercent & Chr(34) & " />"
Else
If InStr(1, rc, "FailedPoints") > 0 Then
myDest.WriteLine "<DCWC:DataPoint XValue=" & Chr(34) & "1" & Chr(34) & " YValues=" & Chr(34) & iFailedPercent & Chr(34) & " />"
Else
If InStr(1, rc, "NotCompletedPoints") > 0 Then
myDest.WriteLine "<DCWC:DataPoint XValue=" & Chr(34) & "1" & Chr(34) & " YValues=" & Chr(34) & iNCPercent & Chr(34) & " />"
Else
If InStr(1, rc, "NotRunPoints") > 0 Then
myDest.WriteLine "<DCWC:DataPoint XValue=" & Chr(34) & "1" & Chr(34) & " YValues=" & Chr(34) & iNoRunPercent & Chr(34) & " />"
Else
myDest.WriteLine rc
End If
End If
End If
End If
Loop
' Close the files
myDest.Close
mySource.Close
' Set blnDontRun
blnDontRun = False
End Function
Public Function CountTestsRunByDate(ByVal strType As String, ByVal strDateFilter As String, Optional strStatus As String, Optional strPriority As String)
Dim tdcTestSetFactory As TestSetFactory
Dim tdcTestFilter As TDFilter
Dim intTestCount As Integer
Dim iAction As Integer
Dim rc As String
iAction = 0
If blnDebug = False Then
On Error GoTo ErrorHandler
End If
' See which kind of search we're doing
If strSubProjectName <> "N/A" Then
iAction = iAction + 1
End If
If strTestCycle <> "N/A" Then
iAction = iAction + 2
End If
Set tdcTestSetFactory = tdc.TestSetFactory
Set tdcTestFilter = tdcTestSetFactory.Filter
tdcTestFilter.Filter(strProjectCycleLabel) = Chr(34) & strProjectName & Chr(34)
tdcTestFilter.Filter(strTestPhaseCycleLabel) = Chr(34) & strTestPhase & Chr(34)
Select Case iAction
Case 1
tdcTestFilter.Filter(strSubProjectCycleLabel) = Chr(34) & strSubProjectName & Chr(34)
Case 2
tdcTestFilter.Filter(strTestCycleLabel) = Chr(34) & strTestCycle & Chr(34)
Case 3
tdcTestFilter.Filter(strSubProjectCycleLabel) = Chr(34) & strSubProjectName & Chr(34)
tdcTestFilter.Filter(strTestCycleLabel) = Chr(34) & strTestCycle & Chr(34)
End Select
Set colTestSets = tdcTestSetFactory.NewList(tdcTestFilter.Text)
intTestCount = 0
For Each objTestSet In colTestSets
rc = objTestSet.TestSetFolder.Path
If InStr(1, rc, "Unattached") = 0 And InStr(1, rc, "99. Archive") = 0 And InStr(1, rc, "Trash") = 0 Then
intTestSetCount = ReturnTestSetCount(objTestSet, strType, strDateFilter, strStatus, strPriority)
intTestCount = intTestCount + intTestSetCount
End If
Next
CountTestsRunByDate = intTestCount
' Destroy objects
Set tdcTestFilter = Nothing
Set colTestSets = Nothing
Exit Function
ErrorHandler:
Call ErrorHandler(Err)
Resume Next
End Function
Public Function ReturnTestSetCount(ByRef objTestSet, ByVal strType As String, ByVal strDateFilter As String, Optional strStatus As String, Optional strPriority As String)
Dim tdcTestFilter As TDFilter
Dim TSTestFact
' Set the TestSet Factory object
Set TSTestFact = objTestSet.TSTestFactory
' Set up the filter
Set tdcTestFilter = TSTestFact.Filter
Select Case strType
Case "Status"
Select Case strStatus
Case "No Run"
tdcTestFilter.Filter("TC_STATUS") = Chr(34) & strStatus & Chr(34)
tdcTestFilter.Filter("TC_PLAN_SCHEDULING_DATE") = strDateFilter
Case "No Run Daily", "No Run Weekly"
tdcTestFilter.Filter("TC_STATUS") = Chr(34) & "No Run" & Chr(34)
tdcTestFilter.Filter(strReplannedDateLabel) = strDateFilter
Case Else
tdcTestFilter.Filter("TC_STATUS") = Chr(34) & strStatus & Chr(34)
tdcTestFilter.Filter("TC_EXEC_DATE") = strDateFilter
End Select
Case "Planned-Baseline"
tdcTestFilter.Filter("TC_PLAN_SCHEDULING_DATE") = strDateFilter
tdcTestFilter.Filter("TC_STATUS") = " Not (" & Chr(34) & "N/A" & Chr(34) & ")"
Case "Replanned"
tdcTestFilter.Filter(strReplannedDateLabel) = strDateFilter
tdcTestFilter.Filter("TC_STATUS") = " Not (" & Chr(34) & "N/A" & Chr(34) & ")"
Case "Actual"
tdcTestFilter.Filter("TC_STATUS") = " Not (" & Chr(34) & "N/A" & Chr(34) & " Or " & Chr(34) & "No Run" & Chr(34) & " Or " & Chr(34) & "Not Completed" & Chr(34) & ")"
tdcTestFilter.Filter("TC_EXEC_DATE") = strDateFilter
Case "Status-Priority"
If strStatus = "No Run" Then
tdcTestFilter.Filter("TC_STATUS") = Chr(34) & strStatus & Chr(34)
tdcTestFilter.Filter("TC_PLAN_SCHEDULING_DATE") = strDateFilter
Else
tdcTestFilter.Filter("TC_STATUS") = Chr(34) & strStatus & Chr(34)
tdcTestFilter.Filter("TC_EXEC_DATE") = strDateFilter
End If
strMyPriority = GetFieldName("Plan: Priority", "TESTCYCL")
tdcTestFilter.Filter(strMyPriority) = Chr(34) & strPriority & Chr(34)
Case "Planned-Priority"
tdcTestFilter.Filter("TC_PLAN_SCHEDULING_DATE") = strDateFilter
tdcTestFilter.Filter("TC_STATUS") = " Not (" & Chr(34) & "N/A" & Chr(34) & ")"
strMyPriority = GetFieldName("Plan: Priority", "TESTCYCL")
tdcTestFilter.Filter(strMyPriority) = Chr(34) & strPriority & Chr(34)
End Select
' Get the list from the filter
Set colTSTests = tdcTestFilter.NewList
' Return the count
ReturnTestSetCount = colTSTests.Count
' Release objects
Set TSTestFact = Nothing
Set tdcTestFilter = Nothing
Set colTSTests = Nothing
End Function
Public Sub GetTestsRun()
Dim intPlannedCount As Integer
Dim intActualCount As Integer
Dim intColumn As Integer
Dim strProjectNameCycleLabel As String
Dim strTestPhaseCycleLabel As String
Dim strDateFilter As String
Dim iCount As Integer
Dim arrWeekends
Dim myDate As Date
Dim dateBonkersDate As Date
Dim blnErrorPage As Boolean
If blnDebug = False Then
On Error GoTo ErrorHandler
End If
iBase = 0
iRep = 0
iExe = 0
iPass = 0
iFail = 0
iNC = 0
iNR = 0
ReDim Preserve arrBaseline(iBase)
arrBaseline(iBase) = "Project Start|0"
ReDim Preserve arrReplanned(iRep)
arrReplanned(iRep) = "Project Start|0"
ReDim Preserve arrExecuted(iExe)
arrExecuted(iExe) = "Project Start|0"
ReDim Preserve arrPassed(iPass)
arrPassed(iPass) = "Project Start|0"
ReDim Preserve arrFailed(iFail)
arrFailed(iFail) = "Project Start|0"
ReDim Preserve arrNC(iNC)
arrNC(iNC) = "Project Start|0"
ReDim Preserve arrNR(iNR)
arrNR(iNR) = "Project Start|" & intTotalPlannedTests
' Get the bonkers date
dateBonkersDate = DateAdd("yyyy", -2, TodaysDate)
' Get test set start and end dates
dateBaselineStart = FindEarliestDate("Planned-Baseline")
datePlannedStart = FindEarliestDate("Replanned")
dateActualStart = FindEarliestDate("Actual")
' See if we've got no dates at all
If dateBaselineStart = "00:00:00" And datePlannedStart = "00:00:00" And dateActualStart = "00:00:00" Then
' No tests sets set up or run so default to error page
blnErrorPage = True
GoTo WriteHTML
End If
' If we've only got an actual date then use it
If dateBaselineStart = "00:00:00" And datePlannedStart = "00:00:00" And dateActualStart <> "00:00:00" Then
myStartDate = dateActualStart
End If
' If we've only got a planned date then use it
If dateBaselineStart = "00:00:00" And datePlannedStart <> "00:00:00" And dateActualStart = "00:00:00" Then
' See if we've got a bonkers date
If datePlannedStart < dateBonkersDate Then
myStartDate = TodaysDate
Else
myStartDate = datePlannedStart
End If
End If
' If we've only got a baseline date then use it
If dateBaselineStart <> "00:00:00" And datePlannedStart = "00:00:00" And dateActualStart = "00:00:00" Then
myStartDate = dateBaselineStart
End If
' If we've got a baseline and a planned but no actual then work out which is earliest
If dateBaselineStart <> "00:00:00" And datePlannedStart <> "00:00:00" And dateActualStart = "00:00:00" Then
If datePlannedStart < dateBaselineStart Then
' See if we've got a bonkers date
If datePlannedStart < dateBonkersDate Then
myStartDate = dateBaselineStart
Else
myStartDate = datePlannedStart
End If
Else
myStartDate = dateBaselineStart
End If
End If
' If we've got a baseline and an actual but no planned then work out which is earliest
If dateBaselineStart <> "00:00:00" And datePlannedStart = "00:00:00" And dateActualStart <> "00:00:00" Then
If dateActualStart < dateBaselineStart Then
myStartDate = dateActualStart
Else
myStartDate = dateBaselineStart
End If
End If
' If we've got a planned and an actual but no baseline then work out which is earliest
If dateBaselineStart = "00:00:00" And datePlannedStart <> "00:00:00" And dateActualStart <> "00:00:00" Then
If dateActualStart < datePlannedStart Then
myStartDate = dateActualStart
Else
' See if we've got a bonkers date
If datePlannedStart < dateBonkersDate Then
myStartDate = dateActualStart
Else
myStartDate = datePlannedStart
End If
End If
End If
' If we've got all of them then work out which is earliest
If dateBaselineStart <> "00:00:00" And datePlannedStart <> "00:00:00" And dateActualStart <> "00:00:00" Then
If dateActualStart < datePlannedStart And dateActualStart < dateBaselineStart Then
myStartDate = dateActualStart
Else
If datePlannedStart < dateBaselineStart Then
' See if we've got a bonkers date
If datePlannedStart < dateBonkersDate Then
myStartDate = dateBaselineStart
Else
myStartDate = datePlannedStart
End If
Else
myStartDate = dateBaselineStart
End If
End If
End If
' Set the start date
myDate = myStartDate
' Now get end dates
dateBaselineEnd = FindLastDate("Planned-Baseline")
datePlannedEnd = FindLastDate("Replanned")
dateActualEnd = FindLastDate("Actual")
' See if we've got no baseline
If dateBaselineEnd = "00:00:00" Then
' See if we've got no planned end
If datePlannedEnd = "00:00:00" Then
' See if we've got no actual
If dateActualEnd = "00:00:00" Then
' Default to today
myEndDate = TodaysDate
Else
If dateActualEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateActualEnd
End If
End If
Else
' See if we've got no actual
If dateActualEnd = "00:00:00" Then
If datePlannedEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = datePlannedEnd
End If
Else
' See if actual is after planned
If dateActualEnd > datePlannedEnd Then
If dateActualEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateActualEnd
End If
Else
If datePlannedEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = datePlannedEnd
End If
End If
End If
End If
Else
' See if we've got no planned end
If datePlannedEnd = "00:00:00" Then
' See if we've got no actual
If dateActualEnd = "00:00:00" Then
' Default to today if baseline end is less
If dateBaselineEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateBaselineEnd
End If
Else
' See if actual is after baseline
If dateActualEnd > dateBaselineEnd Then
If dateActualEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateActualEnd
End If
Else
If dateBaselineEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateBaselineEnd
End If
End If
End If
Else
' See if we've got no actual
If dateActualEnd = "00:00:00" Then
' See if planned is after baseline
If datePlannedEnd > dateBaselineEnd Then
If datePlannedEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = datePlannedEnd
End If
Else
If dateBaselineEnd < Today Then
myEndDate = TodaysDate
Else
myEndDate = dateBaselineEnd
End If
End If
Else
' See if actual is after planned
If dateActualEnd > datePlannedEnd Then
' See if the actual is after the baseline
If dateActualEnd > dateBaselineEnd Then
If dateActualEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateActualEnd
End If
Else
If dateBaselineEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = dateBaselineEnd
End If
End If
Else
' See if the planned is after the baseline
If datePlannedEnd > dateBaselineEnd Then
If datePlannedEnd < TodaysDate Then
myEndDate = TodaysDate
Else
myEndDate = datePlannedEnd
End If
Else
If dateBaselineEnd < Today Then
myEndDate = TodaysDate
Else
myEndDate = dateBaselineEnd
End If
End If
End If
End If
End If
End If