testing with cucumber/webrat

2 views
Skip to first unread message

Matt Harrison

unread,
May 23, 2009, 9:03:18 AM5/23/09
to calendar_d...@googlegroups.com
I've recently started using cucumber (and webrat) to do BDD, and it's
going well, unfortunately I haven't managed to get calendar_date_select
working well with it.

First I have to write custom labels and field names, because the helper
doesn't write the model container "assignment[date]" etc and the label
doesn't match up with the field.

Once I've got the field names recognised, I can't get input to work. My
feature scenario looks something like:

...
And I fill in "Handout" with "2009-05-21 00:00:00"
...
And I should see "2009-05-21 00:00:00"
...

Unfortunately, the data isn't getting into the database because the
output doesn't include any of the passed information. I've also tried
with just Y/M/D, full unix timestamp, display format (May 21, 2009)

Any tips on getting this going greatly appreciated as it's making my
nice green tests fail when I know they work manually.

Thanks

~Matt

Tom Hoen

unread,
May 23, 2009, 9:24:52 AM5/23/09
to calendar_d...@googlegroups.com
Matt - if you haven't done so already, you may want to use cucumber's
"save_and_open_page" to show exactly what cucumber/webrat sees when looking
at the page. I have a step like the following:

Then /^I save and open the page$/ do
save_and_open_page
end

which I can insert into any scenario whenever something isn't going as
expected.

Tom
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.36/2127 - Release Date: 05/22/09
17:56:00

Matt Harrison

unread,
May 23, 2009, 12:50:51 PM5/23/09
to calendar_d...@googlegroups.com
Tom Hoen wrote:
> Matt - if you haven't done so already, you may want to use cucumber's
> "save_and_open_page" to show exactly what cucumber/webrat sees when looking
> at the page. I have a step like the following:
>
> Then /^I save and open the page$/ do
> save_and_open_page
> end
>
> which I can insert into any scenario whenever something isn't going as
> expected.

Thanks for the reply Tom, I've tried adding that but it doesn't appear
to do anything. What is the expected result of adding that into my
scenario? I don't know if it's relevant but I'm not developing on my
desktop, I'm on a remote server.

Thanks

~Matt

Tim Harper

unread,
May 23, 2009, 2:05:19 PM5/23/09
to calendar_d...@googlegroups.com

Haha, yes that is very relevant. Save and open page will create an html in your projects tmp directory, you could download it and view it, or I suppose you could use links :)

Tim

On May 23, 2009 10:50 AM, "Matt Harrison" <iwasinn...@genestate.com> wrote:

Tom Hoen wrote: > Matt - if you haven't done so already, you may want to use cucumber's > "save_and...

Thanks for the reply Tom, I've tried adding that but it doesn't appear
to do anything. What is the expected result of adding that into my
scenario? I don't know if it's relevant but I'm not developing on my
desktop, I'm on a remote server.

Thanks

~Matt

--~--~---------~--~----~------------~-------~--~----~ You received this message because you are sub...

Matt Harrison

unread,
May 23, 2009, 2:47:46 PM5/23/09
to calendar_d...@googlegroups.com
Tim Harper wrote:
> Haha, yes that is very relevant. Save and open page will create an html
> in your projects tmp directory, you could download it and view it, or I
> suppose you could use links :)

Thanks, I've checked the generated page and it seems it's storing a null
value. At least, nothing is being outputted for those two fields.

So how are you guys using a calendar_date_select field from inside a
cucumber/webrat scenario?

Ta

~M

Tim Harper

unread,
May 23, 2009, 6:00:36 PM5/23/09
to calendar_d...@googlegroups.com

Treat it just like a text field :)

On May 23, 2009 12:48 PM, "Matt Harrison" <iwasinn...@genestate.com> wrote:

Tim Harper wrote: > Haha, yes that is very relevant. Save and open page will create an html > in y...

Thanks, I've checked the generated page and it seems it's storing a null
value. At least, nothing is being outputted for those two fields.

So how are you guys using a calendar_date_select field from inside a
cucumber/webrat scenario?

Ta

~M

--~--~---------~--~----~------------~-------~--~----~ You received this message because you are sub...

Matt Harrison

unread,
May 23, 2009, 6:37:30 PM5/23/09
to calendar_d...@googlegroups.com
Tim Harper wrote:
> Treat it just like a text field :)

Well that's what I originally thought, but no matter what I tell webrat
to fill in, nothing seems to get written to the db. At least, nothing is
output when the record is viewed.

I know it's looking at the right field because I've already wrestled
with that problem and solved it. The problem is, because the db data for
the tests is being cleared, I can't go in and see if the fields are
indeed null.

I'm just about out of ideas so I might have to leave the calendar stuff
out of testing :(

Thanks

~M

Reply all
Reply to author
Forward
0 new messages