@@ -2,30 +2,47 @@ import * as tl from 'azure-pipelines-task-lib/task';
22import { manualTestsFlow } from './manualTests'
33import { getTestPlanData , TestPlanData } from './testPlanData'
44import { automatedTestsFlow } from './automatedTests'
5+ import { publishEvent , ciDictionary } from './ciEventLogger' ;
56
67export async function run ( ) {
78
89 const testSelectorInput = tl . getInput ( 'testSelector' ) ;
910 console . log ( 'Test Selector selected : ' + testSelectorInput ) ;
1011
12+ var ciData : ciDictionary = {
13+ TestSelector : testSelectorInput ,
14+ totalNumOfManualTestPoint : 0 ,
15+ totalNumOfAutomatedTestPoint : 0 ,
16+ totalNumOfTestSuites : 0
17+ }
18+
1119 const testPlanInfo = await getTestPlanData ( ) ;
1220
21+ ciData . totalNumOfAutomatedTestPoint = testPlanInfo . listOfAutomatedTestPoints . length ;
22+ ciData . totalNumOfManualTestPoint = testPlanInfo . listOfManualTestPoints . length ;
23+ ciData . totalNumOfTestSuites = testPlanInfo . testSuiteIds . length ;
24+
1325 let manualTestFlowReturnCode = 0 ;
1426 let automatedTestFlowReturnCode = 0 ;
1527
1628 // trigger manual, automated or both tests based on user's input
1729 if ( testSelectorInput . includes ( 'manualTests' ) ) {
1830 manualTestFlowReturnCode = await manualTestsFlow ( testPlanInfo ) ;
1931 tl . debug ( `Execution Status Code for Manual Test Flow is ${ manualTestFlowReturnCode } ` ) ;
32+ ciData [ "manualTestFlowReturnCode" ] = manualTestFlowReturnCode ;
2033 }
34+
2135 if ( testSelectorInput . includes ( 'automatedTests' ) ) {
22- automatedTestFlowReturnCode = await automatedTestsFlow ( testPlanInfo , testSelectorInput ) ;
36+ automatedTestFlowReturnCode = await automatedTestsFlow ( testPlanInfo , testSelectorInput , ciData ) ;
2337 tl . debug ( `Execution Status Code for Automated Test Flow is ${ automatedTestFlowReturnCode } ` ) ;
38+ ciData [ "automatedTestFlowReturnCode" ] = automatedTestFlowReturnCode ;
2439 }
2540
2641 if ( manualTestFlowReturnCode || automatedTestFlowReturnCode ) {
2742 tl . setResult ( tl . TaskResult . Failed , "Faced error in execution." ) ;
2843 }
44+
45+ publishEvent ( ciData ) ;
2946}
3047
3148run ( ) ;
0 commit comments