xebia/Xebium — Issue #23: Be more flexible with selecting a way to execute tests
Author: amolenaar
Created: 2011-11-03 10:34:46+00:00
State: open

I've been running some tests with Sauce Labs today. It strikes me as annoying that I have to change my start-browser command every time I want to test on another environment.

The dependency on browser can be dealt with by defining it as a variable. However I can test to:

1. local, using web driver
| start browser | firefox | on url | http://example.saucelabs.com |
2. local, using selenium server (requires server to be started using SeleniumServerFixture
| start browser | firefox | on url | http://example.saucelabs.com | using remote server |
3. Remotely, using web driver (e.g. to SauceLabs) (Se2 style)
| Need to come up with something, key-value pairs have to be defined in a Capabilities object and passed to a RemoteWebDriver instance |
4. Remotely, using Selenium server (Se1 style)
| start browser | { "username": "your name", "access-key": "some-uuid", "os": "Windows 2003", "browser": "firefox", "browser-version": "7", "name": "Testing Selenium 1 from Xebium" } | on url | http://example.saucelabs.com | using remote server on host | ondemand.saucelabs.com | on port | 80 |

For each version different statements are included. This makes it very complex to switch from one config to another (in a CI setting it's not possible even).

One solution would be to use the syntax as shown in option 4. and allow that to be used for option 1 as well (they're different code paths now!). The org.json.json package is already included through Selenium-server, so we already have that dependency. Defining a special words `remote-server` with a format `server:port' will make the `| using remote server |` part obsolete. Making `remote-server` an empty string would default to `localhost:4444`.

TODO: How to distinguish between WebDriver and Http (Selenium 1) driver?