99
1010public class CucumberListener implements EventListener {
1111
12- public static int count_totalTCs = 0 ;
13- public static int count_passedTCs = 0 ;
14- public static int count_skippedTCs = 0 ;
15- public static int count_failedTCs = 0 ;
16-
1712 @ Override
1813 public void setEventPublisher (EventPublisher publisher ) {
1914 //Set all events that need use (public). Override from EventListener
@@ -34,7 +29,7 @@ private void runStarted(TestRunStarted event) {
3429 // Execute after @After in hook
3530 private void runFinished (TestRunFinished event ) {
3631 LogUtils .info ("********* RUN FINISHED *********" );
37- ReportUtils .openReports (SystemHelpers .getCurrentDir () + PropertiesHelpers .getValue ("extent.reporter.spark.out" ));
32+ // ReportUtils.openReports(SystemHelpers.getCurrentDir() + PropertiesHelpers.getValue("extent.reporter.spark.out"));
3833 }
3934
4035 // This event is triggered when feature file is read
@@ -49,56 +44,50 @@ private void featureRead(TestSourceRead event) {
4944 private void ScenarioStarted (TestCaseStarted event ) {
5045// LogUtils.info("Scenario Path: " + event.getTestCase().getUri().toString());
5146// LogUtils.info("Scenario Name: " + event.getTestCase().getName());
52- count_totalTCs = count_totalTCs + 1 ;
5347 }
5448
5549 private void ScenarioFinished (TestCaseFinished event ) {
56- Result result = event .getResult ();
57-
58- if (Status .PASSED .equals (result .getStatus ())) {
59- count_passedTCs = count_passedTCs + 1 ;
60- }
61- if (Status .FAILED .equals (result .getStatus ())) {
62- count_failedTCs = count_failedTCs + 1 ;
63- }
64- if (Status .SKIPPED .equals (result .getStatus ())) {
65- count_skippedTCs = count_skippedTCs + 1 ;
66- }
50+ // Result result = event.getResult();
51+ //
52+ // if (Status.PASSED.equals(result.getStatus())) {
53+ //
54+ // }
55+ // if (Status.FAILED.equals(result.getStatus())) {
56+ //
57+ // }
58+ // if (Status.SKIPPED.equals(result.getStatus())) {
59+ //
60+ // }
6761 }
6862
6963 // Step started event
7064 private void stepStarted (TestStepStarted event ) {
71- String stepName = "" ;
72- String keyword = "" ;
73-
74- // Check whether the event is from a hook or step
75- if (event .getTestStep () instanceof PickleStepTestStep ) {
76- // TestStepStarted event implements PickleStepTestStep interface
77- // Which have additional methods to interact with the event object
78- // So we have to cast TestCase object to get those methods
79- PickleStepTestStep steps = (PickleStepTestStep ) event .getTestStep ();
80- stepName = steps .getStep ().getText ();
81- keyword = steps .getStep ().getKeyword ();
82- } else {
83- // Same with HookTestStep
84- HookTestStep hoo = (HookTestStep ) event .getTestStep ();
85- stepName = hoo .getHookType ().name ();
86- }
65+ // String stepName = "";
66+ // String keyword = "";
67+ //
68+ // if (event.getTestStep() instanceof PickleStepTestStep) {
69+ // PickleStepTestStep steps = (PickleStepTestStep) event.getTestStep();
70+ // stepName = steps.getStep().getText();
71+ // keyword = steps.getStep().getKeyword();
72+ // } else {
73+ // HookTestStep hoo = (HookTestStep) event.getTestStep();
74+ // stepName = hoo.getHookType().name();
75+ // }
8776 }
8877
8978 // This is triggered when test Step is finished
9079 private void stepFinished (TestStepFinished event ) {
91- Result result = event .getResult ();
92-
93- if (Status .PASSED .equals (result .getStatus ())) {
94-
95- }
96- if (Status .FAILED .equals (result .getStatus ())) {
97-
98- }
99- if (Status .SKIPPED .equals (result .getStatus ())) {
100-
101- }
80+ // Result result = event.getResult();
81+ //
82+ // if (Status.PASSED.equals(result.getStatus())) {
83+ //
84+ // }
85+ // if (Status.FAILED.equals(result.getStatus())) {
86+ //
87+ // }
88+ // if (Status.SKIPPED.equals(result.getStatus())) {
89+ //
90+ // }
10291 }
10392
10493}
0 commit comments