Pyccuracy 0.1.0
First of all I want to say that I’m sorry for the infamous name that I gave this project, but I simple couldn’t resist converting Accuracy to Pyccuracy (watch out for Accuruby, lol).
Anyway, the project is here. I got almost a version that could be released, even though it has only a handful of actions, thus not being able to properly test even the simplest of sites (I can only test Google so far!).
I won’t go into detail here but Pyccuracy (at least the first version, since it’s very loosely coupled) uses Selenium for underlying manipulation of browser instances. So more than half the glory goes to the amazing teams at ThoughtWorks for doing such a great job with Selenium-RC.
The Language
Since Python gives me much more freedom in defining a DSL than .Net does, I went for an external DSL to do the trick here. So far the DSL is defined in .acc files (from Accuracy, since .pyc is already used by python), such as:
As a Google User
I want to search Google
So that I can test Pyccuracy
Scenario 1 - Searching for Hello World
Given
I go to "http://www.google.com"
When
I fill "q" textbox with "Hello World"
And I click "btnG" button
Then
I see "Hello World - Pesquisa Google" title
Scenario 2 - Searching for Monty Python
Given
I go to "http://www.google.com"
When
I fill "q" textbox with "Monty Python"
And I click "btnG" button
Then
I see "Monty Python - Pesquisa Google" title
This test starts Selenium Server, uses Selenium R/C to navigate a browser (defaults to Firefox) to http://www.google.com, fills a textbox with the name of “q” with the text “Hello World”, clicks a button called “btnG” and checks that the title for the browser instance is “Hello World – Google Search”, after the next page (after the click) finishes loading. The second scenario is analogous.
This may seem like a trivial thing, but it’s got immense possibilities! This is how you run your tests:
pyc = Pyccuracy()
pyc.run_tests()
How about running tests for more than one browser?
pyc = Pyccuracy()
pyc.run_tests(browsers=(“iexplore”, “firefox”))
Want to use a different root folder for your tests?
pyc = Pyccuracy()
pyc.run_tests(root="/path/to/test/files”)
And so on, and so forth.
The great advantage that this technique has over the .Net cousin is that due to it’s easy nature of parsing the external files, it turns out to be REALLY easy to include new actions and to evolve the DSL.
Current Situation
We already have a google groups for the project at http://groups.google.com/group/pyccuracy (Fixed thanks to Chris Read!). If you want to help feel free to join the group and comment on discussions or suggest anything.
At the google groups page there’s also a cheat sheet of urls for the project, including the SVN repository and the JIRA tickets server. JIRA is a great way to see what’s coming next.
My good friend Claudio Figueiredo will create a Pypi project (egg) soon, and when we release this version you can easy_install it.
So far that’s it!
Cheers,