Chapter 11. Running Thucydides tests from the command line
You typically run Thucydides as part of the build process (either locally or on a CI server). In addition to the webdriver.driver
option discussed about, you can also pass a number of parameters in as system properties to customize the way the tests are run. The full list is shown here:
-
webdriver.driver: What browser do you want your tests to run in: firefox, chrome or iexplorer.
-
webdriver.base.url: The default starting URL for the application, and base URL for relative paths.
-
webdriver.timeouts.implicitlywait: How long webdriver waits for elements to appear by default, in milliseconds.
-
thucydides.outputDirectory: Where should reports be generated.
-
thucydides.only.save.failing.screenshots : Should Thucydides only store screenshots for failing steps? This can save disk space and speed up the tests a little. It is very useful for data-driven testing.
-
thucydides.restart.browser.frequency: During data-driven tests, some browsers (Firefox in particular) may slow down over time due to memory leaks. To get around this, you can get Thucydides to start a new browser session at regular intervals when it executes data-driven tests.
-
thucycides.step.delay: Pause (in ms) between each test step.
-
untrusted.certificates: Useful if you are running Firefox tests against an HTTPS test server without a valid certificate. This will make Thucydides use a profile with the AssumeUntrustedCertificateIssuer property set.
-
thucydides.timeout: How long should the driver wait for elements not immediately visible.
-
thucydides.browser.width and thucydides.browser.height: Resize the browser to the specified dimensions, in order to take larger screenshots. This should work with Internet Explorer and Firefox, but not with Chrome.
-
thucydides.resized.image.width : Value in pixels. If set, screenshots are resized to this size. Useful to save space.
-
thucydides.issue.tracker.url: The URL used to generate links to the issue tracking system.
-
thucydides.activate.firebugs : * Activate the Firebugs and FireFinder plugins for Firefox when running the WebDriver tests. This is useful for debugging, but is not recommended when running the tests on a build server.
-
thucydides.batch.count: If batch testing is being used, this is the size of the batches being executed.
-
thucydides.batch.number :If batch testing is being used, this is the number of the batch being run on this machine.
-
thucydides.restart.browser.frequency : Restart the browser every so often during data-driven tests.
An example of using these parameters is shown here:
$ mvn test -Dwebdriver.driver=iexplorer -Dwebdriver.base.url=http://myapp.staging.acme.com
This will run the tests against the staging server using Internet Explorer.
-
webdriver.firefox.profile: The path to the directory of the profile to use when starting firefox. This defaults to webdriver creating an anonymous profile. This is useful if you want to run the web tests using your own Firefox profile. If you are not sure about how to find the path to your profile, look here: http://support.mozilla.com/en-US/kb/Profiles. For example, to run the default profile on a Mac OS X system, you would do something like this:
$ mvn test -Dwebdriver.firefox.profile=/Users/johnsmart/Library/Application\ Support/Firefox/Profiles/2owb5g1d.default
On Windows, it would be something like:
C:\Projects\myproject>mvn test -Dwebdriver.firefox.profile=C:\Users\John Smart\AppData\Roaming\Mozilla\Firefox\Profiles\mvxjy48u.default
-
thucydides.history: The directory in which build history summary data is stored for each project. Each project has it’s own sub-folder within this directory. Defaults to ~./thucydides.
If you want to set default values for some of these properties for your own development environment (e.g. to always activate the Firebugs plugin on your development machine), create a file called thucydides.properties
in your home directory, and set any default values here. These values will still be overridden by any values defined in the environment variables. An example is shown here:
thucydides.activate.firebugs = true
thucydides.browser.width = 1200