Forum: Ruby on Rails acceptance test parameters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
373e8ca5f9ee2167de04083c9c908b2c?d=identicon&s=25 Lune Lune (lune9)
on 2009-03-20 11:43
Hi,

I wrote an acceptance test (using selenium) to test a specific product.
But I would like to specify to my test the id of the product to test.

I run my test with the command rake test:acceptance my_test.rsel

I tried the following syntax : rake test:acceptance my_test.rsel 1 for
the id #1 but it doesn't work.


How can I do??

Thanks
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2009-03-20 13:09
(Received via mailing list)
Lune Lune wrote:

> I wrote an acceptance test (using selenium) to test a specific product.
> But I would like to specify to my test the id of the product to test.

Firstly, a test that requires input is not a "test", it is a "script" or
"utility". A true test would work from a list of products and test all
of them,
unattended.

That said, understand that rake is a program that runs programs, so it
does not
pass arguments to them by default. I think there's a system for that,
but this
always works on make-style programs:

   rake PRODUCT=1 test:acceptance ...

Then access the PRODUCT inside the test with ENV['PRODUCT'].
373e8ca5f9ee2167de04083c9c908b2c?d=identicon&s=25 Lune Lune (lune9)
on 2009-03-20 13:38
Phlip wrote:
> Lune Lune wrote:
>
>> I wrote an acceptance test (using selenium) to test a specific product.
>> But I would like to specify to my test the id of the product to test.
>
> Firstly, a test that requires input is not a "test", it is a "script" or
> "utility". A true test would work from a list of products and test all
> of them,
> unattended.
>
> That said, understand that rake is a program that runs programs, so it
> does not
> pass arguments to them by default. I think there's a system for that,
> but this
> always works on make-style programs:
>
>    rake PRODUCT=1 test:acceptance ...
>
> Then access the PRODUCT inside the test with ENV['PRODUCT'].

You perfectly understand what I want to do. but it says that
ENV['PRODUCT'] is nil
This topic is locked and can not be replied to.