Discussion:
[Cucumber] [JVM] Examples Data in Hooks
(too old to reply)
Justin Radcliffe
2017-05-10 13:25:57 UTC
Permalink
Raw Message
Hi, is it possible to get Examples data in the hooks? I'm tagging my
examples different from the scenario and wanted to pull that data out.


@MNMS @SEARCH @GEN10


Scenario Outline: Verify the links on the Mobile Number Change
Given an enrolled vehicle
And MNMS data is available
When the advisor selects the mobile number change <links>
Then the links display the appropriate <MEIDLocator>



@TC_185836

Examples:

| links | MEIDLocator |

| Manage Mobile Number | ManageMobileNumber.link_ESN_MEID_IMEI |


@TC_185837

Examples:

| links | MEIDLocator |

| Mobile Number Change | MobileNumberChange.link_ESN_MEID_IMEI |



I would like to get the tags from the Examples to be able to update and
report on those test case ids, which are our manual tester ids vs the
automation id that would be in the scenario itself.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Andrew Premdas
2017-05-10 13:43:15 UTC
Permalink
Raw Message
If you have separate test case ids, why don't you just write a scenario for
each test case. It would be much simpler than using a scenario outline, and
you have the ability to introduce more context about what the difference is
between the two examples. Reading your scenario I want to know what the
advisor is trying to achieve in each example.
Post by Justin Radcliffe
Hi, is it possible to get Examples data in the hooks? I'm tagging my
examples different from the scenario and wanted to pull that data out.
@MNMS @SEARCH @GEN10
Scenario Outline: Verify the links on the Mobile Number Change
Given an enrolled vehicle
And MNMS data is available
When the advisor selects the mobile number change <links>
Then the links display the appropriate <MEIDLocator>
@TC_185836
| links | MEIDLocator |
| Manage Mobile Number | ManageMobileNumber.link_ESN_MEID_IMEI |
@TC_185837
| links | MEIDLocator |
| Mobile Number Change | MobileNumberChange.link_ESN_MEID_IMEI |
I would like to get the tags from the Examples to be able to update and
report on those test case ids, which are our manual tester ids vs the
automation id that would be in the scenario itself.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-05-10 14:37:01 UTC
Permalink
Raw Message
Yeah, I agree we can do that. Just seeing if its possible to grab the
examples data.
Post by Andrew Premdas
If you have separate test case ids, why don't you just write a scenario
for each test case. It would be much simpler than using a scenario outline,
and you have the ability to introduce more context about what the
difference is between the two examples. Reading your scenario I want to
know what the advisor is trying to achieve in each example.
Post by Justin Radcliffe
Hi, is it possible to get Examples data in the hooks? I'm tagging my
examples different from the scenario and wanted to pull that data out.
@MNMS @SEARCH @GEN10
Scenario Outline: Verify the links on the Mobile Number Change
Given an enrolled vehicle
And MNMS data is available
When the advisor selects the mobile number change <links>
Then the links display the appropriate <MEIDLocator>
@TC_185836
| links | MEIDLocator |
| Manage Mobile Number | ManageMobileNumber.link_ESN_MEID_IMEI |
@TC_185837
| links | MEIDLocator |
| Mobile Number Change | MobileNumberChange.link_ESN_MEID_IMEI |
I would like to get the tags from the Examples to be able to update and
report on those test case ids, which are our manual tester ids vs the
automation id that would be in the scenario itself.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
------------------------
Andrew Premdas
blog.andrew.premdas.org
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to a topic in the
Google Groups "Cukes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/cukes/OgxxZK4wOI0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-07-21 13:27:29 UTC
Permalink
Raw Message
I made a work around to this until cucumber 2.0 and Gherkin 4 are shipped :

We can get the Examples description and use that for storing the testcase
id.

public String getScenarioStepsForTestCaseID(String testCaseName,
Scenario scenario) throws IOException {
LOGGER.debug("getScenarioStepsForTestCaseID started");

String scenarioId = scenario.getId();

List<String> scenarioInfo = Arrays.asList(scenarioId.split(";"));

Map<String, String> scenarioDetails = new HashMap<String, String>();

// "<feature name>;<scenario name>",
// or in case of scenario outlines, the concatenation of
//
"<featurename>;<scenariooutlinename>;<examplesgroupname>;<tablerownumber>"
// https://github.com/cucumber/cucumber-jvm/issues/715

int size = scenarioInfo.size();
scenarioDetails.put("featureName", scenarioInfo.get(0));
scenarioDetails.put("scenarioName", scenarioInfo.get(1));
if (size == 4) {
LOGGER.debug("A Scenario Outline is being ran and we are on row
" + scenarioInfo.get(3)
+ " of the example table.");
scenarioDetails.put("exampleName", scenarioInfo.get(2));
}

String testCaseNo = "TC_" + testCaseName.replace("TC", "");
String sName = scenario.getName();
List<String> stepDefintions =
getResourceFiles(ReportConstants.PATH_TO_FEATURES);
LOGGER.debug("getScenarioStepsForTestCaseID stepDefintions list : "
+ stepDefintions);
return readFeatureFileForTC(stepDefintions, testCaseNo,
sName).toString();
}


@MNMS @SEARCH @GEN10


Scenario Outline: Verify the links on the Mobile Number Change
Given an enrolled vehicle
And MNMS data is available
When the advisor selects the mobile number change <links>
Then the links display the appropriate <MEIDLocator>



@TC_185836

Examples: *TC_185836 *- IMEI

| links | MEIDLocator |

| Manage Mobile Number | ManageMobileNumber.link_ESN_MEID_IMEI |


@TC_185837

Examples: *TC_185837 *- IMEI2

| links | MEIDLocator |

| Mobile Number Change | MobileNumberChange.link_ESN_MEID_IMEI |
Post by Justin Radcliffe
Hi, is it possible to get Examples data in the hooks? I'm tagging my
examples different from the scenario and wanted to pull that data out.
@MNMS @SEARCH @GEN10
Scenario Outline: Verify the links on the Mobile Number Change
Given an enrolled vehicle
And MNMS data is available
When the advisor selects the mobile number change <links>
Then the links display the appropriate <MEIDLocator>
@TC_185836
| links | MEIDLocator |
| Manage Mobile Number | ManageMobileNumber.link_ESN_MEID_IMEI |
@TC_185837
| links | MEIDLocator |
| Mobile Number Change | MobileNumberChange.link_ESN_MEID_IMEI |
I would like to get the tags from the Examples to be able to update and
report on those test case ids, which are our manual tester ids vs the
automation id that would be in the scenario itself.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...