[LRUG] Time Based Requirements for Feature testing

David Henry dw_henry at yahoo.com.au
Thu Oct 1 10:07:06 PDT 2009


Hello,

Was wondering if anyone else had encountered this problem and if there was a nice rubish solution:

NOTE: this is not the fully problem but a cut down version to help get the answer I want..

I am trying to find a way to get the below to work in a Celerity Test (Have also looked at using Selenium but it didn't seem to have a solution to this problem either)

I have an create action which can be performed before 12pm, however after 12pm it should not be possible to perform the action (both the link to perform the create should not be displayed and attempting to create should fail.  I want this to run as a feature to ensure all the parts work together as expected.  The below scenarios cover the flow that I want.. 
Scenario 1 (Booked before 12pm => should create without issue):
>Given I have an Existing Advice
>And the time is 11am
>Then I can see 'Book Trade'
>When I follow 'Book Trade'
>And I book a 'Trade'
>Then I can see Successfully booked trade
>
>Scenario 2 (try to book after 12pm => should not be link to create):Given I have an Existing Advice
>And the time is 13am
>Then I can NOT see 'Book Trade'
>
>Scenario 3 (Start to book before 12pm but wait until after 12pm to try and save => should follow link but fail on save):Given I have an Existing Advice
>And the time is 11am
>Then I can see 'Book Trade'
>When I follow 'Book Trade'
>And the time is 13amAnd I book a 'Trade'
>Then I can see 'Trade Booking Failed'
The only approach I can think of is to somehow stub out Time.now to return the required values (this is what I have done in the RSpec) and yes I am aware this should not really be done in Feature.. 

This does not work as celerity is actually running in a different process.

Doe anyone know how to write a feature for this senario so that I can control what time it is on the test server.

Thanks for your help

David

    

David Henry
Chief Technology Officer
Lyagushka Limited
Phone: +44 78 7928 2112



      __________________________________________________________________________________
Get more done like never before with Yahoo!7 Mail.
Learn more: http://au.overview.mail.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20091001/861e3984/attachment-0003.html>


More information about the Chat mailing list