Discussion:
[Cucumber] [JVM] How to use datatable in step definition to work with rows
(too old to reply)
umar kayani
2013-04-29 09:29:11 UTC
Permalink
Hi

I am currently having an issue and have researched the issue without avail

I have a feature file that contains a datatable setup as follows (not
exactly word-for-word but contains the basis of my setup)

Then verify if <validfilename> has been consumed
Example:
| validfilename
| valid.json
| invalid.json
...

My issue is that I need access the datatable in my step definition so I can
work with it, such as using IF statements on the validfilename

It seems that the actually datatable values are passed into the step
definition, as I can comment out one of the filenames, and then the next
filename is put in it's placeholder section

Is there any way I can get access to the entire contents of the datatable
so I can work with it?

Thanks

P.S sorry if my question seems sporadically worded, I can clarify it if
needs be
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Paolo Ambrosio
2013-04-29 11:48:00 UTC
Permalink
Post by umar kayani
Then verify if <validfilename> has been consumed
| validfilename
| valid.json
| invalid.json
...
Is there any way I can get access to the entire contents of the datatable so
I can work with it?
Hi,

I believe you are using Scenario Outlines but what you want are Data
Tables: http://cukes.info/step-definitions.html#data_tables


Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-29 11:52:50 UTC
Permalink
Hi Paulo

Yes that's right, I want to use data tables

However I am having difficulty incorporating this in my step def

Would I need to convert the table into a 2D array or something, and if so,
how would I go about doing this?

Apologies for the very noob approach, i'm very new to cucumber and would
appreciate the help

Thanks once again
Post by umar kayani
Post by umar kayani
Then verify if <validfilename> has been consumed
| validfilename
| valid.json
| invalid.json
...
Is there any way I can get access to the entire contents of the
datatable so
Post by umar kayani
I can work with it?
Hi,
I believe you are using Scenario Outlines but what you want are Data
Tables: http://cukes.info/step-definitions.html#data_tables
Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Paolo Ambrosio
2013-04-29 13:46:00 UTC
Permalink
Post by umar kayani
Yes that's right, I want to use data tables
However I am having difficulty incorporating this in my step def
Would I need to convert the table into a 2D array or something, and if so,
how would I go about doing this?
Hi,

I'm unsure on what the problem is. If it is how to use the DataTable
object passed by Cucumber-JVM to your step definition, have you tried
looking at the public methods of that class? If that is not the issue,
can you be more specific?


Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-29 13:53:39 UTC
Permalink
I want to convert the DataTable values to a list so that I can use them in
an IF statement

so basically with the following

| validfilenames |
| valid.json |
| invalid.json |

I would like to be able to use valid.json and invalid.json in my step
definition
Post by Paolo Ambrosio
Post by umar kayani
Yes that's right, I want to use data tables
However I am having difficulty incorporating this in my step def
Would I need to convert the table into a 2D array or something, and if
so,
Post by umar kayani
how would I go about doing this?
Hi,
I'm unsure on what the problem is. If it is how to use the DataTable
object passed by Cucumber-JVM to your step definition, have you tried
looking at the public methods of that class? If that is not the issue,
can you be more specific?
Paolo
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group, send email to
https://groups.google.com/d/forum/cukes?hl=en
---
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/groups/opt_out.
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Oscar Rieken
2013-04-29 13:58:49 UTC
Permalink
why not just load the file into a hashmap

I think this is a bad idea i would probably do something different but
you could

use the file name in the example then in the step find the file with that
name
then convert the json into a hashmap to make it easier to manage and do
whatever you need to validate the file?
Post by umar kayani
I want to convert the DataTable values to a list so that I can use them in
an IF statement
so basically with the following
| validfilenames |
| valid.json |
| invalid.json |
I would like to be able to use valid.json and invalid.json in my step
definition
Post by Paolo Ambrosio
Post by umar kayani
Yes that's right, I want to use data tables
However I am having difficulty incorporating this in my step def
Would I need to convert the table into a 2D array or something, and if
so,
Post by umar kayani
how would I go about doing this?
Hi,
I'm unsure on what the problem is. If it is how to use the DataTable
object passed by Cucumber-JVM to your step definition, have you tried
looking at the public methods of that class? If that is not the issue,
can you be more specific?
Paolo
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group, send email to
at https://groups.google.com/d/forum/cukes?hl=en
---
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/groups/opt_out.
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group, send email to
https://groups.google.com/d/forum/cukes?hl=en
---
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/groups/opt_out.
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-29 14:47:08 UTC
Permalink
Maybe I wasn't too clear on what I need to do, sorry

All i'm wanting to do is something along the lines of this

if (fileName == "valid.json") {
// do some stuff
} else if (fileName == "invalid.json") {
// do something else
}

The file names should be picked up from the datatable in the feature file

Hope that makes things a bit clearer?
Post by Oscar Rieken
why not just load the file into a hashmap
I think this is a bad idea i would probably do something different but
you could
use the file name in the example then in the step find the file with that
name
then convert the json into a hashmap to make it easier to manage and do
whatever you need to validate the file?
Post by umar kayani
I want to convert the DataTable values to a list so that I can use them
in an IF statement
so basically with the following
| validfilenames |
| valid.json |
| invalid.json |
I would like to be able to use valid.json and invalid.json in my step
definition
Post by Paolo Ambrosio
Post by umar kayani
Yes that's right, I want to use data tables
However I am having difficulty incorporating this in my step def
Would I need to convert the table into a 2D array or something, and if
so,
Post by umar kayani
how would I go about doing this?
Hi,
I'm unsure on what the problem is. If it is how to use the DataTable
object passed by Cucumber-JVM to your step definition, have you tried
looking at the public methods of that class? If that is not the issue,
can you be more specific?
Paolo
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a
new topic instead.
You received this message because you are subscribed to the Google
Groups Cukes group. To post to this group, send email to
options, visit this group at
https://groups.google.com/d/forum/cukes?hl=en
---
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
For more options, visit https://groups.google.com/groups/opt_out.
--
-- Rules --
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group, send email to
group at https://groups.google.com/d/forum/cukes?hl=en
---
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/groups/opt_out.
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Paolo Ambrosio
2013-04-29 20:47:05 UTC
Permalink
First of all: please STOP top posting. Read rule 2 and apply it!
Post by umar kayani
Maybe I wasn't too clear on what I need to do, sorry
[...]
Hope that makes things a bit clearer?
I'm sorry, but it is still not clear to me what you are trying to do.
You did not even post a single complete scenario! Hope someone else
can help you, because without reading any concrete example, I think I
will never understand what you are trying to do.


Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-30 07:45:44 UTC
Permalink
Post by Paolo Ambrosio
First of all: please STOP top posting. Read rule 2 and apply it!
sorry about that

My scenario is as follows

Scenario Outline: valid message passed to new system
When old system passes <validfilename>
Then verify if new system has consumed that <validfilename>
Examples:
| validfilename |
| Valid.json |
| Cancel.json |

My step definition is as follows

When(~'^old system passes (.+)$') {
// work with the file names from the above Examples table
}

At the point of the regular expression above, that's where the
validfilename should be transposed to, I then want to check if that
validfilename is x or y and in turn do the correct logic under each
statement
Post by Paolo Ambrosio
Post by umar kayani
Maybe I wasn't too clear on what I need to do, sorry
[...]
Hope that makes things a bit clearer?
I'm sorry, but it is still not clear to me what you are trying to do.
You did not even post a single complete scenario! Hope someone else
can help you, because without reading any concrete example, I think I
will never understand what you are trying to do.
Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Paolo Ambrosio
2013-04-30 08:10:34 UTC
Permalink
Post by umar kayani
My scenario is as follows
Scenario Outline: valid message passed to new system
When old system passes <validfilename>
Then verify if new system has consumed that <validfilename>
| validfilename |
| Valid.json |
| Cancel.json |
My step definition is as follows
When(~'^old system passes (.+)$') {
// work with the file names from the above Examples table
}
At the point of the regular expression above, that's where the validfilename
should be transposed to, I then want to check if that validfilename is x or
y and in turn do the correct logic under each statement
Your scenario outline would be executed as two distinct scenarios:

Scenario: valid message passed to new system
When old system passes Valid.json
Then verify if new system has consumed that Valid.json

Scenario: valid message passed to new system
When old system passes Cancel.json
Then verify if new system has consumed that Cancel.json

The data table is used by Cucumber to expand the scenario "template"
into two distinct scenarios. You have no access to the table in the
examples section.

You can use your implementation and you will get one single file name at a time:

When(~'^old system passes (.+)$') { String fileName ->
if (fileName == "Valid.json") {
// do some stuff
} else if (fileName == "Cancel.json") {
// do something else
}
}

...or you can define two separate steps:

When(~'^old system passes Valid.json$') {
// ...
}

When(~'^old system passes Cancel.json$') {
// ...
}

I still cannot understand "work with the file names from the above
Examples table", as there is no examples table after the scenario
outline is expanded into the two scenarios. Everything is done by
Cucumber before running your steps so you will never receive the
example table in your step definitions.


Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-30 09:17:46 UTC
Permalink
Post by umar kayani
Post by umar kayani
My scenario is as follows
Scenario Outline: valid message passed to new system
When old system passes <validfilename>
Then verify if new system has consumed that <validfilename>
| validfilename |
| Valid.json |
| Cancel.json |
My step definition is as follows
When(~'^old system passes (.+)$') {
// work with the file names from the above Examples table
}
At the point of the regular expression above, that's where the
validfilename
Post by umar kayani
should be transposed to, I then want to check if that validfilename is x
or
Post by umar kayani
y and in turn do the correct logic under each statement
Scenario: valid message passed to new system
When old system passes Valid.json
Then verify if new system has consumed that Valid.json
Scenario: valid message passed to new system
When old system passes Cancel.json
Then verify if new system has consumed that Cancel.json
The data table is used by Cucumber to expand the scenario "template"
into two distinct scenarios. You have no access to the table in the
examples section.
When(~'^old system passes (.+)$') { String fileName ->
if (fileName == "Valid.json") {
// do some stuff
} else if (fileName == "Cancel.json") {
// do something else
}
}
When(~'^old system passes Valid.json$') {
// ...
}
When(~'^old system passes Cancel.json$') {
// ...
}
I still cannot understand "work with the file names from the above
Examples table", as there is no examples table after the scenario
outline is expanded into the two scenarios. Everything is done by
Cucumber before running your steps so you will never receive the
example table in your step definitions.
Paolo
Hi Paulo

Thanks a lot for your patience with me!

So from what I understand, your saying that the Examples table I am using

| validfilenames |
| valid.json |
| cancel.json |
etc

is not passed into the step definition as a whole? So I can't actually
iterate over that Examples table rows and have to either split the
validfilenames into separate scenarios and NOT a scenario outline OR define
the validfilenames as seperate steps in my step def

Hmm seems a bit messy as I have quite a lot of files to go through, however
you've given me the only plausible ways to go about this

Thanks a lot for your help, i'll go and try this out now
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Paolo Ambrosio
2013-04-30 10:07:55 UTC
Permalink
Post by umar kayani
So from what I understand, your saying that the Examples table I am using
| validfilenames |
| valid.json |
| cancel.json |
etc
is not passed into the step definition as a whole? So I can't actually
iterate over that Examples table rows and have to either split the
validfilenames into separate scenarios and NOT a scenario outline OR define
the validfilenames as seperate steps in my step def
Yes, scenario outlines are only templates to generate scenarios from
example data, and that table is not available in step definitions.
Data tables, as I wrote a few posts back, are instead a way of
providing data in a tabular format to step definitions. The syntax is
slightly different:

Scenario: valid message passed to new system
When old system passes
| validfilename |
| Valid.json |
| Cancel.json |
Then verify if new system has consumed
| validfilename |
| Valid.json |
| Cancel.json |

Of course it looks awful in your case, but it would pass the two
tables as a DataTable object to the step definition (as I wrote
before). I haven't tried it with Groovy, but I guess it works. You
could even combine scenario outlines and data tables, but that in most
cases is overkill.

A better approach to remove duplication would be to add a given step:

Scenario: valid message passed to new system
Given there is a list of files to be passed
| filename |
| Valid.json |
| Cancel.json |
When the old system passes the files
Then the new system should consume the files

As part of the given step you would save the list of files and use it
in both the other steps.

An even better way of writing this scenario would probably be to
completely remove the data table from the scenario:

Scenario: valid message passed to new system
Given there is a list of valid files
When the old system passes all the files
Then the new system should consume all the files

You can then hide the implementation of what is "valid" in the step
definition. One more suggestion is not to use "valid", but to explain
what valid means, and in what way the others are invalid.
Post by umar kayani
Hmm seems a bit messy as I have quite a lot of files to go through, however
you've given me the only plausible ways to go about this
I guess the best way to go would be to refactor your scenarios using a
declarative style instead of an imperative one. Even if you are not
interested in Cucumber-Ruby, "The Cucumber Book" is an excellent read
and a concentrate of best practices to write scenarios and step
definitions: well worth the money. There are also a few of very
interesting videos of CukeUp talks that you should watch. A couple
VERY interesting are Matt's...

* Refuctoring Your Cukes
http://skillsmatter.com/podcast/agile-scrum/refuctoring-your-cukes
* Why your step definitions should be one-liners and other pro tips
http://skillsmatter.com/podcast/java-jee/why-your-step-definitions-should-be-one-liners-and-other-pro-tips


Hope you find this useful :-)


Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
umar kayani
2013-04-29 14:11:51 UTC
Permalink
Hi

The file name gets picked up ok, however when I try to add it into a list
(for example) i end up getting a message outputted that the list is null
afterwards

I'm using groovy for the step definition

I can see the files come through to the step def, if I comment them out one
by one in the .feature file, so it seems that the step def knows about the
datatable rows.

Is there any way in Groovy of converting the JSON into a hashmap?

Again, sorry for the questions, i'm new to cucumber and not overly familiar
with Groovy either

Thanks for the help!
Post by umar kayani
Post by umar kayani
Then verify if <validfilename> has been consumed
| validfilename
| valid.json
| invalid.json
...
Is there any way I can get access to the entire contents of the
datatable so
Post by umar kayani
I can work with it?
Hi,
I believe you are using Scenario Outlines but what you want are Data
Tables: http://cukes.info/step-definitions.html#data_tables
Paolo
--
-- Rules --

1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.

You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cukes-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org To unsubscribe from this group, send email to cukes+***@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...