3

I use JUnit and Selenium (1) to write automated integration tests. I've used it on a couple of projects so far.

I find the Selenium API too low-level, and end up writing generic 'wrapper' code, to deal with things like:

  • checking the fields of a form are the same as they were before some 'save' button was clicked
  • sharing the selenium instance between tests
  • checking the browser isn't showing a stack trace
  • waiting for elements to become present (from AJAX calls)

Is this an inevitable part of writing your own test harness? Or is there a wrapper library somewhere / should I bother to create one?

artbristol
  • 32,010
  • 5
  • 70
  • 103

3 Answers3

1

These days I would use FluentLenium which covers a lot of what I asked for originally: https://github.com/FluentLenium/FluentLenium

artbristol
  • 32,010
  • 5
  • 70
  • 103
1

Personally I think that Selenium 2 is about the right abstraction level for a browser automation framework. I agree with you that there are some annoying things like handling waiting for ajax calls which could have a bit more support in the framework but in Selenium 2 there's a support package which will probably contain those features when it is right to include them.

The rest of the points you mention seem to me like project specific features which you wouldn't want in the core framework. You can easily roll your own framework which is right for your kind of projects (and you should) or you can search the internet for projects which contain stuff you also find usefull and adjust. For example I've based my testsuite on this: http://code.google.com/p/design-of-selenium-tests-for-asp-net/ but there are many more higher level frameworks ( some super highlevel ) built on top of selenium which you will find with a search ( http://code.google.com/hosting/search?q=selenium&projectsearch=Search+projects ).

So yeah, I think it's inevitable but it shouldn't cost you that much work.

Ivo Grootjes
  • 612
  • 3
  • 8
1

You can create DSL for application driver using the Page Object pattern and the windowlicker (Java GUI testing framework which uses Selenium 2) for implementation.

More theory and practice techniques see in:

http://www.wakaleo.com/blog/279-selenium-2web-driver-the-land-where-page-objects-are-king

http://www.slideshare.net/alimenkou/dsl-page-object-and-selenium-a-way-to-reliable-functional-tests/

http://www.growing-object-oriented-software.com/

Groove developers can use Tellurium Automated Testing Framework:

http://code.google.com/p/aost/

Tellurium vs Selenium : Compare

Community
  • 1
  • 1
Andriy Plokhotnyuk
  • 7,883
  • 2
  • 44
  • 68