Skip to content

Running Madcow Tests

gavinbunney edited this page Feb 15, 2011 · 1 revision

Running Madcow Tests

Running all tests

By default, the runMadcow.sh and runMadcow.bat scripts will execute all tests.

Running an individual test file or set of test files

To run a single or set of test files pass the following arguments to the script

./runMadcow.sh -test TestOne,TestTwo,TestThree

Do not specify the file extensions of the tests! We will figure that out for you.

Running an individual test within a CSV test

To run a single test within a csv file, add an exclamation mark and then the test name.

./runMadcow.sh -test CsvExample\!test_Two

The exclamation mark must be escaped using a '' in Linux and Mac OSX.

Running an individual test or worksheet within a spreadsheet test

To run an individual worksheet or test from a spreadsheet test, add an exclamation mark and then the name of the test or worksheet that you want to execute.

./runMadcow.sh -test spreadsheet_test\!Test7
./runMadcow.sh -test spreadsheet_test\!WorkSheet1

Emulating a specific browser when running a test

Madcow gives users the ability to emulate a specific browser when running a test or set of tests from ant. To do so, simply add the "browser" property to your ant call, for example:

./runMadcow.sh -test TestOne,TestTwo,TestThree -browser {browser}

Where browser is one of the following:

  • InternetExplorer6
  • InternetExplorer7
  • Firefox2
  • Firefox3

If no browser is specified, Madcow will use Firefox 3 as the default browser to emulate.

Running a specific suite of tests

Madcow has the ability to only run a specific subset of tests, a suite, using a specific suite pattern. This will match on the name of a particular directory(s) using the ant pattern matching syntax - see the Ant Pattern Matching Reference for further details.

To do so, simply add the suite property to your execution. For example, to run all tests which are contained (or within a child folder) in a folder named finance:

./runMadcow.sh -suite finance

This suite pattern will match on the specific folder name, regardless of it's depth within the project hierarchy. So if we have a project structure as follows:

tests
  |
  --- development
      |
      --- finance
  --- integrated
      |
      --- finance

Then running a suite of finance will execute both tests within the development/finance suite and the integrated/finance suite. To only have a specific finance suite run, you also need to specify the parent directory; such as to only run the integrated finance suite, it is specified as follows:

./runMadcow.sh -suite integrated/finance

Running an individual Madcow Test within your IDE

Within your IDE you can run groovy tests individually by

  • Setting a VM option within the run configuration. Set the {{basedir}} option to point at the root directory of the Madcow project
-Dbasedir=/to/your/project/root/dir
  • Ensure that the .madcow/lib and .madcow/webtest/lib directories are on the classpath.

Running Madcow Tests using ANT

Running all tests from ant

To run all tests simply run the default ant target (run-all-tests) by running ant.

ant

Running an individual test file or set of test files from ant

To run a single or set of test files from ant run the following target

ant run-tests -DmadcowTests="TestOne,TestTwo,TestThree"

Running an individual test within a CSV or Spreadsheet test

To run a single test within a CSV or Spreadsheet file, add an exclamation mark and then the test name, or sheet name.

ant run-tests -DmadcowTests='csv_test!test 3'
ant run-tests -DmadcowTests='spreadsheet_test!Test7'
ant run-tests -DmadcowTests='spreadsheet_test!WorkSheet1'

Emulating a specific browser when running a test from Ant

ant run-tests -DmadcowTests="TestOne,TestTwo,TestThree" -Dbrowser="{browser}"

Running a specific suite of tests

To run a specific suite of tests from ant, run the following target and set the madcowSuitesPattern ant property

ant run-all-tests -DmadcowSuitesPattern="integrated/finance"
Clone this wiki locally