test or development environment for ad hoc testing via web interface but with fixtures

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

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.

Greg Hauptmann 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...

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

Greg Hauptmann 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. :wink: