== tdrunner
TDRunner
Table of contents:
* Introduction
* Supported frameworks
* Installation
* TDRunner long period testing modes
* TDRunner parameters
* TDRunner Profiles
o Preprocessing with ERb
o Execution profiles
* Howto use TDRunner with Cucumber
* Howto use TDRunner with Test::Unit
Introduction
TDRunner is a tool for runnig long period testing for different opensource test frameworks. With TDRunner you can execute long period testing using different parameters and execution profiles.
Supported frameworks
* Cucumber
* Test::Unit
Installation
TDRunner is distributed in a regular rubygems application and you can install it using command.
gem install tdrunner
TDRunner long period testing modes
TDRunner supports the following LPT execution modes:
* LPT duration in hours
* LPT duration in iterations
* LPT duration in end date and time stamp
* LPT with execution profiles
TDRunner parameters
TDRunner command has two sections:
tdrunner [options] [framework command]
* [options]
o This is the section where TDRunner parameters are defined
* [framework command]
o This is the section where the test framework specific command is defined
o For cucumber the framework command shoud start with cucumber
o For Test::Unit the framework command shoud start with test_suite
* [options]
o -H i Defines how many hours tdrunner will run i as number of hours.
+ Executes tests for 1.5 hours:
tdrunner -H 1.5 cucumber features
o -i i Defines how many iterations tdrunner will run the tests i as number of iterations.
+ Repeats tests for ten iterations:
tdrunner -i 10 test_suite ts_my_test_unit_suite.rb
o -d "date time" Defines end date and time when tdrunner will stop testing.
+ Runs tests until defined date and time is reached:
tdrunner -d "12.12.2100 12:00" cucumber features
o -e execution_profile Defines tdrunner to use execution profile for running tests.
+ Runs tests using execution profile:
tdrunner -e my_execution_profile -d "12.12.2100 12:00" test_suite ts_my_test_unit_suite.rb
o --teardown Defines test unit teardown only when the testcase is failed.
+ Run test unit teardown only when the testcase is failed:
tdrunner --teardown -i 10 test_suite ts_my_test_unit_suite.rb
o -p profile_name Pull commandline arguments from tdrunner.yml which can be defined as strings or arrays.
+ Run tests using a tdrunner profile:
tdrunner -p my_profile_name
TDRunner Profiles
TDRunner lets you store and reuse commonly used tdrunner command line arguments for a project in a tdrunner.yml or tdrunner.yaml file.
NOTE: This file must be in your project�s root directory, config or .config.
For example, by having this in your config/tdrunner.yml:
default: -i 100 cucumber features
html_report: -H 1 cucumber features -f TDriverReport::CucumberListener
You can reuse the arguments listed above:
tdrunner -p html_report
Preprocessing with ERb
The tdrunner.yml file is preprocessed by ERb; this allows you to use ruby code to generate values in the tdrunner.yml file. So if you have several profiles with similar values you could do something like:
<% common = "-i 100" %>
default: <%= common %> cucumber features
html_report: <%= common %> cucumber features -f TDriverReport::CucumberListener
Execution profiles
You can define execution profiles with emphasis for test cases using parameter -e profile_file_name. When profile file is defined and it does not exist tdrunner will create the sip file for you and add the tests in to the file with default emphasis value 1.
NOTE: This file must be in your project�s root directory, config or .config.
For example, by having this in your config/calculator.sip for Test::Unit tests:
test_simple_addition(TC_Calculator)=3
test_memory_recall(TC_Calculator)=1
test_memory_store(TC_Calculator)=1
test_simple_addition(TC_Calculator)=1
Will execute test_simple_addition test three times more than the other tests. The default emphasis for tests is 1.
For example, by having this in your config/calculator.sip for cucumber tests:
features/move.feature=1
features/move_mouse.feature=3
features/press_key.feature=1
Will execute move_mouse.feature test three times more than the other tests. The default emphasis for tests is 1.
NOTE: The tests which do not have a emphasis value are added automatically in to the execution profile with default value 1.
To run tdrunner with execution profile use -e rofile_file_name parameter in your tdrunner command:
tdrunner -H 2 -e calculator test_suite my_test_unit_suite.rb
Howto use TDRunner with Cucumber
TDRunner command has two sections:
tdrunner [options] [framework command]
* [options]
o This is the section where TDRunner parameters are defined
* [framework command]
o This is the section where the test framework specific command is defined
o For cucumber the framework command shoud start with cucumber
-
Install tdrunner
-
Go to your test folder where cucumber features folder is located
-
Run command:
tdrunner -h
this displays the tdrunner help.
-
Test tdrunner by running a command:
tdrunner -i 2 cucumber your_feature_folder_name
Howto use TDRunner with Test::Unit
TDRunner command has two sections:
tdrunner [options] [framework command]
* [options]
o This is the section where TDRunner parameters are defined
* [framework command]
o This is the section where the test framework specific command is defined
o For Test::Unit the framework command shoud start with test_suite
-
Install TDriver
-
Install tdrunner
-
Go to your test folder where cucumber features folder is located
-
Run command:
tdrunner -h
this displays the tdrunner help.
-
Test tdrunner by running a command:
tdrunner -i 2 test_suite your_test_suite_file_name