« Return to Thread: [Functional Testing] Two Sessions?

Re: [Functional Testing] Two Sessions?

by Robert Fischer :: Rate this Message:

Reply to Author | View in Thread

Of course, if you create your version, I can create mine from it.  :)

~~ Robert.

Robert Fischer wrote:

> That'd work.
>
> The approach I was thinking about was userA.get("/messages"),
> userB.post("/messages"), etc., etc., with a forClient(client) { ... }
> structure for grouping together multiple actions.  My usage is going to
> involve a lot of switching back and forth, so explicit lines switching
> clients is a bit chatty.
>
> ~~ Robert.
>
> Marc Palmer wrote:
>>
>> On 2 Jul 2009, at 15:42, Robert Fischer wrote:
>>
>>> I'm testing an interactive feature of my app, and I want to use
>>> g-func[1] to test it.  This means I need to have two sessions on at
>>> the same time, so that when one does something, I can check for a
>>> change in the other.  Is there an easy way to do this that I'm missing?
>>
>>
>> Not currently no.
>>
>> Depending on what is a reasonable feature need, there are a couple of
>> ways to cut it.
>>
>> For example, I think we would probably be able to swap out the
>> HtmlUnit webclient for a new one mid-test, and pull back the other one
>> by name. This effectively gives you separate browsers / sessions.
>>
>> Another way would be to pull out pretty much everything from
>> FunctionalTestCase into a FunctionTestClient that you can have
>> multiple of and the test case class would just manage the "current"
>> one and delegate all calls to it.
>>
>> If the interaction you want to test is something like:
>>
>> 1. User A submits a chat message
>> 2. User B refresh chat to see user A's message
>> 3. User B submits reply chat message
>> 4. User A refreshes to see B's message
>>
>> Then I think this is still well within the ethos of G-Func as it is
>> nicely linear and the tests remain easy to grok etc.
>>
>> We could implement that quite simply I think, something like:
>>
>> client "User A"
>>
>> get("/messages")
>>
>> client "User B"
>>
>> post('/messages') { .... }
>>
>> client "User A"
>>
>>
>> Eg the client method just switches to a named client.
>>
>> Marc
>>
>> ~ ~ ~
>> Marc Palmer
>> Blog         > http://www.anyware.co.uk
>> Twitter      > http://twitter.com/wangjammer5
>> Grails Rocks > http://www.grailsrocks.com
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>

--
~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: [Functional Testing] Two Sessions?