Well, this was just a test I had to write to validate some response from my
server. Depending on the type of request, is returns a different response.
At first, I'd like to run something like:
Given I access my server at localhost:1234
When I send the request <req>
Then I should receive <resp>
Example:
|req|resp|
|reqtype1|<resp>
<foo>foo</foo>
<bar> bar </bar>
</resp>|
|reqtype2|<resp>
<foo>foo</foo>
<bar> bar </bar>
</resp>|
As I couldn't get this working, I had to duplicate the tests.
I agree that using files is a good workaround, but I also agree with Dan
that it makes the test description a little bit unreadable.
Regards,
Robison
On Fri, Sep 30, 2011 at 11:21 AM, Dan McDaid <[email protected]>wrote:
> Entering a filepath into a table doesn't really make for a readable test,
> all it says is that you are entering text from some file. To someone
> reading the gherkin syntax it isn't very meaningful and doesn't describe
> accurately what the test is. If the exact text isn't important (i.e. it the
> reader wouldn't have to look in the file) then reconsider the test/steps to
> read/be more generic.
>
> I may be wrong about this but it's the conclusion I came to recently with
> this problem.
>
>
> What is the context of this test?
>
> Regards,
> Dan
>
>
> On 30 September 2011 15:09, louis gueye <[email protected]> wrote:
>
>> Nice workaround Mauro,
>>
>> Thx.
>>
>>
>> 2011/9/30 Mauro Talevi <[email protected]>
>>
>>> Hi Robinson,
>>>
>>> no, that's not possible because the table is parsed line by line. If we
>>> parsed it by regex (like the stories) we would not be able to tell when a
>>> new row started (without introducing additional markup).
>>>
>>> What I'd suggest is that you put your multiline input into a file and
>>> insert the path to that file in the table cell.
>>>
>>> Cheers
>>>
>>>
>>> On 30/09/2011 18:31, Robison Santos wrote:
>>>
>>> Hi, I'm wondering if there's any way to use a multi-line example table in
>>> my story definitions. Something like:
>>>
>>> Given I have something already setup
>>> When I enter the data <data_input>
>>> Then I should receive the text <text_output>
>>>
>>> Example:
>>> |data_input|test_output|
>>> | data1 | "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
>>> do eiusmod
>>> tempor incididunt ut labore et dolore magna aliqua. Ut
>>> enim ad minim
>>> veniam, quis nostrud exercitation ullamco laboris
>>> nisi ut
>>> aliquip ex ea commodo consequat." |
>>> | data2 | "Another text" |
>>>
>>>
>>> Is this possible any way?
>>>
>>> Thanks,
>>>
>>> --
>>> Robison W R Santos
>>>
>>>
>>>
>>
>
--
Robison W R Santos
Bach. Ciências da Computação
"NUNCA generalise. Generalisar é SEMPRE um erro."