Welcome to Manicprogrammer Sign in | Join | Help

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,

Published Monday, February 09, 2009 9:14 PM by heynemann

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Pyccuracy 0.1.0

Tuesday, February 10, 2009 5:51 AM by Chris Read

Greetings...

Your Groups URL link is wrong. It should be http://groups.google.co.uk/group/pyccuracy

Chris

# re: Pyccuracy 0.1.0

Tuesday, February 10, 2009 8:18 AM by Pawel Tarnik

Bernardo, could you please clarify it to me?

Do you see Pyccuracy as a replacement for Stormwind.Accuracy? I mean - is it alternative, or something different?

# re: Pyccuracy 0.1.0

Tuesday, February 10, 2009 11:35 AM by heynemann

@Chris

Thanks for the url fix! Already fixed!

@Pawel

No it´s not a replacement. It's an option!

If you prefere to write your tests under NUnit in a complete .Net environment stick to Accuracy.

If you'd rather write them in a more clear language using the external DSL and don't mind that your tests will depend on Python to run, use Pyccuracy.

Or if you are doing python or django coding, Pyccuracy is a very attractive solution.

Thanks for the comments! :)

# Pyccuracy 0.1.0 | Planeta Globo.com

Thursday, April 16, 2009 1:12 AM by Pyccuracy 0.1.0 | Planeta Globo.com

Enter the text you see in the image:

Leave a Comment

(required) 
required 
(required)