@@ -2,30 +2,47 @@ import * as tl from 'azure-pipelines-task-lib/task';
2
2
import { manualTestsFlow } from './manualTests'
3
3
import { getTestPlanData , TestPlanData } from './testPlanData'
4
4
import { automatedTestsFlow } from './automatedTests'
5
+ import { publishEvent , ciDictionary } from './ciEventLogger' ;
5
6
6
7
export async function run ( ) {
7
8
8
9
const testSelectorInput = tl . getInput ( 'testSelector' ) ;
9
10
console . log ( 'Test Selector selected : ' + testSelectorInput ) ;
10
11
12
+ var ciData : ciDictionary = {
13
+ TestSelector : testSelectorInput ,
14
+ totalNumOfManualTestPoint : 0 ,
15
+ totalNumOfAutomatedTestPoint : 0 ,
16
+ totalNumOfTestSuites : 0
17
+ }
18
+
11
19
const testPlanInfo = await getTestPlanData ( ) ;
12
20
21
+ ciData . totalNumOfAutomatedTestPoint = testPlanInfo . listOfAutomatedTestPoints . length ;
22
+ ciData . totalNumOfManualTestPoint = testPlanInfo . listOfManualTestPoints . length ;
23
+ ciData . totalNumOfTestSuites = testPlanInfo . testSuiteIds . length ;
24
+
13
25
let manualTestFlowReturnCode = 0 ;
14
26
let automatedTestFlowReturnCode = 0 ;
15
27
16
28
// trigger manual, automated or both tests based on user's input
17
29
if ( testSelectorInput . includes ( 'manualTests' ) ) {
18
30
manualTestFlowReturnCode = await manualTestsFlow ( testPlanInfo ) ;
19
31
tl . debug ( `Execution Status Code for Manual Test Flow is ${ manualTestFlowReturnCode } ` ) ;
32
+ ciData [ "manualTestFlowReturnCode" ] = manualTestFlowReturnCode ;
20
33
}
34
+
21
35
if ( testSelectorInput . includes ( 'automatedTests' ) ) {
22
- automatedTestFlowReturnCode = await automatedTestsFlow ( testPlanInfo , testSelectorInput ) ;
36
+ automatedTestFlowReturnCode = await automatedTestsFlow ( testPlanInfo , testSelectorInput , ciData ) ;
23
37
tl . debug ( `Execution Status Code for Automated Test Flow is ${ automatedTestFlowReturnCode } ` ) ;
38
+ ciData [ "automatedTestFlowReturnCode" ] = automatedTestFlowReturnCode ;
24
39
}
25
40
26
41
if ( manualTestFlowReturnCode || automatedTestFlowReturnCode ) {
27
42
tl . setResult ( tl . TaskResult . Failed , "Faced error in execution." ) ;
28
43
}
44
+
45
+ publishEvent ( ciData ) ;
29
46
}
30
47
31
48
run ( ) ;
0 commit comments