aanand / deadweight

NOT MAINTAINED
MIT License
1.19k stars 52 forks source link

Testing Workflow? #6

Closed jfelchner closed 12 years ago

jfelchner commented 13 years ago

I think that this is an excellent gem and a fantastic idea; especially for static sites.

Unfortunately when you have to deal with multiple user login types that can see certain pages but not others, you would seem to be recreating a bunch of that logic in deadweight configurations which is also in your tests. And what if you add a page? Now you have to remember to add it to your Deadweight configurations.

After a few minutes of thinking about it, here's the implementation that I thought might be valuable:

In Cucumber's before all run:

Deadweight.start

In Cucumber's after all section:

Deadweight.stop

It will keep track of all CSS being used by every page load that Cucumber performs. Since us Ruby folk are typically test-crazy, this should hit all the possible scenarios that the app/site would go through.

This would include flash error messages, form error messages, etc which would almost never get caught by a standard page load.

By default it drops a file called deadweight.log in the tmp directory of the app.

There are tons of possibilities of creating formatters... maybe an HTML format that shows all the styles in their styles for easy reference.

I'm fully prepared to help out so let me know what you think.

aanand commented 13 years ago

Yes. Yes. Thoughtbot actually described a similar thing in a recent blog post, though they dump the HTML out to files and then process it. In any case, exploiting the test suite is a brilliant idea, and the Rack middleware injection technique looks like a winner.

I might have a bit of time over the next week or two to dedicate to this, so if you feel like forking and getting the ball rolling, I'll hopefully be able to join in soon.

aanand commented 13 years ago

Right. Version 0.2.0 just dropped, with a test suite hijacking prototype. Check the README for details, and try it out.