# Test or development environment for ad hoc testing via web i

**URL:** <https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032>\
**Category:** Rails\
**Created:** [February 9, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032 "2007-02-09T12:34:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [February 9, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032/1 "2007-02-09T12:34:25Z")

</div>

Hi,

Just wondering what the recommended approach would be to carry out ad  
hoc  
testing of one’s application via the web interface, but noting you want  
to  
leverage use of the various test data you have put together in test  
fixtures  
(i.e. used for automated testing).

Would the concept be to use the test environment but run a unit test  
first  
which setup test data in the database via fixtures?

Tks  
Greg

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [February 9, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032/2 "2007-02-09T19:15:13Z")

</div>

If you just need to get fixtures into development mode I would just do  
it from the command line.

At the command line, I believe you’ll want:

rake db:fixtures:load RAILS\_ENV=development

Then you will have the data you wanted in development mode and you can  
go from there.

On Feb 9, 5:32 am, “Greg H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [February 9, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032/3 "2007-02-09T19:33:14Z")

</div>

Greg H. wrote:

> Just wondering what the recommended approach would be to carry out ad hoc  
> testing of one’s application via the web interface, but noting you want to  
> leverage use of the various test data you have put together in test fixtures  
> (i.e. used for automated testing).
> 
> Would the concept be to use the test environment but run a unit test first  
> which setup test data in the database via fixtures?

The old-school, pre-TDD technique here is to configure a  
development-only mode for the site. I use a CSS class of  
‘developmental’, and set it to display:none in production mode.

Then I put a couple extra buttons in the banner that load sample data  
and trigger various states.

I can’t use db:fixtures:load anymore because I want my client to enter  
data and preserve it between manual tests, and the fixture system  
wipes every named table. So I just dumped the database and trimmed it  
down to an ugly stack of SQL INSERT statements.

Oh, and my automated tests have the option to hit those buttons, too…

–  
Phlip  
[http://c2.com/cgi/wiki?ZeekLand](http://c2.com/cgi/wiki?ZeekLand) ← NOT a blog!!

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [February 9, 2007, 9:18pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032/4 "2007-02-09T21:18:27Z")

</div>

tks Monki - excellent

Phlip(anyone) - I was thinking of using also a test button coupled with  
a  
test action for the purpose of emulating the response from paypal. I  
was  
pondering how to ensure both the button & action could only be got at in  
development mode (and perhaps test)?

Would a check “if RAILS\_ENV == “development” then …” used in the view  
and  
controller action be secure enough to prevent someone breaking into this  
test code?

Tks  
Greg

---

<div class="post-metadata">

**Author:** ![greg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/71c47a/32.png) [@greg](https://www.ruby-forum.com/u/greg)\
**Post date:** [February 9, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/test-or-development-environment-for-ad-hoc-testing-via-web-i/85032/5 "2007-02-09T22:20:44Z")

</div>

Greg H. wrote:

> Phlip(anyone) - I was thinking of using also a test button coupled with a  
> test action for the purpose of emulating the response from paypal. I was  
> pondering how to ensure both the button & action could only be got at in  
> development mode (and perhaps test)?

Just one more tip:

if RAILS\_ENV == “development”  
def magic\_disappearing\_action  
naughty\_methods\_here  
end  
end

Yes, you can write raw Ruby inside a class, for conditional  
compilation. That’s because Ruby…

----\> doesn’t give a shit \<----

…but in a good way. 😉

–  
Phlip  
[http://c2.com/cgi/wiki?ZeekLand](http://c2.com/cgi/wiki?ZeekLand) ← NOT a blog!!
