From: Bill Mosteller Date: 2009-10-22T23:02:15+09:00 Subject: Test::Unit - Ruby Unit Testing Framework Questions Recently, we collected several (29) Selenium Ruby scripts and put them into a unit test that runs whenever there’s a build of our product. That’s been reasonably successful, but our developers would like more. Specifically, they would like us to include asserts inside of our scripts. I see two challenges to this. First, I need guidance on when to code an assertion. I have some ideas, but like all the open source documentation I see so far, the emphasis seems to be on syntax rather than semantics. Second, I’m a little concerned about inconvenience when I’m debugging an individual test in the unit test package. The following are real code examples from my environment. Run the campaign canvas script under IE: Today: driver $ ca (11 characters) With Test::Unit: selenium_tests.rb --name test_create_canvas (45 characters, and I cannot pick the browser) Driver.rb invokes the browser of choice ($ in this case, the default is Firefox if it cannot make out what you asked for), then runs the chosen script (ca, chosen out of an if/elsif stack with case insensitivity and matching to the string supplied, even if it’s abbreviated). With Test::Unit: I lose the ability to pick browser and have to do a lot more typing to pick a test, and that typing has to be spot on. I can help the latter problem with some careful re-naming. I had thought to turn driver into a unit test by surrounding it with the basic code, but I cannot figure out how to get to the ARGV array once I do that, so I cannot read the command line. ________________________________________________________________________________________ Bill Mosteller | Test Automation | office: (703) 584-2768 | fax: (703) 584-2751 bill.mosteller@eloqua.com | Eloqua www.eloqua.com | 1921 Gallows Road, Suite 250, Vienna, VA 22182 -- Posted via http://www.ruby-forum.com/.