I have written an event publisher on "TestCaseStarted". However it return the wrong line number when I am trying to access its location. I am using below code and feature file.
Expected Line number should be 4 but I am getting value as 13
Feature File
Feature: to test a sample test case
@tc1
Scenario Outline: sc1
Given user has waited for "1" seconds and clicked checkboxes
|button_id|
|a |
|b |
When user has to enter"<Value>"
Then validates that the scenarios completes successfully
Examples:
|Value |
|3 |
|5 |
Code Snippet
private void EHTestCaseStarted(TestCaseStarted event) {
String ffPath = event.getTestCase().getUri().getPath();
String scnType = event.getTestCase().getKeyword();
Location loc = event.getTestCase().getLocation();
int scnLine = event.getTestCase().getLocation().getLine();
int scnCol = event.getTestCase().getLocation().getColumn();
if (scnType.equalsIgnoreCase("Scenario Outline")) {
parseGherkin(ffPath, scnLine, scnCol);
} else {
}
}