Thursday, February 26, 2009
This might be a "duh!" thing but...
I'm sure this is probably how things are normally done in the programming-language world, but it was new to me. Thanks to Bret for providing this insight.
Integrating Ruby testing in Intellij and TeamCity...made easy
For example, in my environment at work, our development environment is Java, and the tools are very Jetbrain-centric. They use Intellij for their and IDE and (more important for me) use TeamCity for continuous integration. This has two implications for me:
- JetBrains has a Ruby plugin for Intellij which works really well, so I can use the same dev environment as our developers, even though I'm working in Ruby. It has code highlighting and code intelligence, and generally works well. I'm also playing with RubyMine, a Jetbrains all-Ruby IDE. It is based on Intellij so it has a great editor, but also supports Rake and has a nifty GUI test runner. Right now it's in "free preview mode", I'm told when it releases it will be $99, which seems pretty reasonable.
- One requirement I had when I started working for McAfee is that our component-level tests integrate into our TeamCity environment, so that test runs could be scheduled to be kicked off and so that test results would be easily viewable by anyone on the team at the location they are already going to. This was easy, because TeamCity has a "command line" option for it's build runner. That means anything that can be kicked off through the command line can be scheduled to run. Of course, this includes RSpec-enabled Ruby scripts. Since RSpec includes an option to output to HTML, and since TeamCity has a way of pointing to build "artifacts" to view from their website, I just set up my configuration so that the script outputs to an HTML file, and then pointed to that HTML file as my build artifact. In this way, I can run Ruby tests and produce an HTML report in the TeamCity environment.
Wednesday, February 25, 2009
Customizing watir-console
One thing you can do to make watir-console even more useful is to write a startup script. Here are the steps:
- Create a helper script and put it in one of the Ruby library directories (such as C:\ruby\lib\ruby\1.8). Let's call it helper.rb.
- Create a .irbrc file (just a text file) and store it in \ruby\bin. This is actually a Ruby file, and can have any Ruby commands you want to start up when Ruby starts. For our purposes, your script should 'require' the script you built in step 1.
That's it! Now, helper.rb (and its methods and constants) will be available in watir-console whenever you run it.
"What should I put in helper.rb", you ask? I'm a believer in examples, so here are a few examples of methods I created:
- A 'login()' method to start a browser, go to the login page for my web app and log in. It returns the IE object, so it can be called from watir-console as "instance = login()". This allows you to then access "instance" as the IE instance to be manipulated.
- Now you can run different methods to do different things. For example, my application does queries, so I have a 'new_query()' method that simply navigates to the page where I can create a query. It is accessed by calling 'new_query(instance)' from watir-console.
Tuesday, February 24, 2009
Monday, February 23, 2009
Ruby Design Patterns - an epiphany
I’ve been reading Russ Olsen’s great book, Design Patterns in Ruby. I’ve always had my developer friends tell me design patterns are a great thing, the jelly to your peanut butter, the Martin to your Lewis if you are a software developer. I gave it the typical…”huh…I’ll have to check that out...sometime.”
Take a look at this book…it will definitely cause you to think in a different way. And that’s always a good thing.
Saturday, February 21, 2009
Brett Pettichord working on new Watir testing framework
I guess my initial question is...what exactly does it provide that Watir/RSpec doesn't? I might download and play with it some...will blog about my impressions.
MountainWest RubyConf 2009 - see ya there
Also, I may be presenting to the Software Association of Oregon (SOA) in the near future about Ruby, Watir and RSpec (and how to build a web testing framework using them). Stay tuned.
The idea behind this blog
Welcome to my black-cloud-qa-type, Ruby world.