On 8 Apr 2009, at 14:56, Francis Fish wrote:

> If the app doesn't recognise the domain name (or it isn't supplied) it
> redirects to a nice page saying, sorry but I don't know what you want
> me to do.
>
> I want to get to the app from inside my test env so I can run a
> cucumber script against it. In rspec I could just mock all this out
> easy peasy but cucumber doesn't seem to understand mocking, or if it
> does the documentation is extremely well hidden in a darkened basement
> past a big sign saying "beware of the lion".
>
> In a similar vein I want to start from another form after having
> mocked logging in so I can test that part independently.
>
> It's taken all day to get this far, because the default webrat steps
> script didn't have the path stuff in and I had to get the script from
> Ryan Bates' site and then mess about persuading webrat to do its
> stuff. Plus, I had to create the paths file from scratch too. As usual
> Ryan makes it look easy but it isn't.
>
> Any ideas, guys?

My first recommendation is: don't mock in Cucumber features!  (Unless  
they are deliberately lower-level features.)  You want something that  
runs the *real* app under *real* conditions, or you can't say for sure  
that your features prove your app works (which is a roundabout way of  
saying, they don't).

What I would do is have a standard set of domains and put them in /etc/ 
hosts.  You could have, say,

127.0.0.1 nonexistant.myapp
127.0.0.1 wibbly.myapp

Even better, put them in a rake task, like `rake  
configure_testing_hosts` or some such, that adds these lines in if  
they are missing.

Then your feature runs can just use these two localhost aliases.  It's  
not brilliant to couple these to the test environment, BUT it's better  
than faking it in the app.

Second recommendation: don't try to separate authentication/ 
authorisation and you app apart.  If you have to log in to access  
something, that's part of the scenario.  You need a "Given 'I am  
logged in...'" step in your Background to achieve this.

Anyway the above is just what I do.  HTH.

Ashley

BTW are you coming to the user-stories/Cucumber night on the 16th? =)

-- 
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
http://aviewfromafar.net/
http://twitter.com/ashleymoran







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to