Difference between revisions of "REPETITIOUS TESTS"
m (Topic titles in capital letters) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Issues]] / Back to [[Test Automation Issues]]</span | + | <div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Issues]] / Back to [[Test Automation Issues]]</span> |
=<span style="font-family: Arial; font-size: 16px">'''Issue summary'''</span>= | =<span style="font-family: Arial; font-size: 16px">'''Issue summary'''</span>= | ||
<span style="font-family: Arial; font-size: 16px">Test cases repeat the same actions on different data</span> | <span style="font-family: Arial; font-size: 16px">Test cases repeat the same actions on different data</span> | ||
+ | |||
=<span style="font-size: 16px">'''Category'''</span>= | =<span style="font-size: 16px">'''Category'''</span>= | ||
<span style="font-size: 16px">Design</span> | <span style="font-size: 16px">Design</span> | ||
+ | |||
=<span style="font-family: Arial; font-size: 16px">'''Examples'''</span>= | =<span style="font-family: Arial; font-size: 16px">'''Examples'''</span>= | ||
− | + | <span style="font-family: Arial; font-size: 16px">A number of automated test cases are doing basically the same test, but using different data values. To test an ordering system, for instance, you have tests for different types of customer (new, existing, bad credit risk, etc) who order different types of things, different numbers of things at different values, different shipping options, etc. All of the tests have the same basic structure: enter a customer (name, address etc), items ordered, delivery option, and the sum that should be payable for that order.<br /><br /></span> | |
+ | |||
+ | <span style="font-family: Arial; font-size: 16px">If you have used capture replay, for example, each of these tests would be a separate script, but each script repeats the same basic control instructions, with the relevant data for the test within the test (programmers call this 'hard-coded' data). This approach guarantees high maintenance costs because these are [[BRITTLE SCRIPTS]]; they are repetitious because they all repeat (needlessly) the same instructions. </span> | ||
+ | |||
=<span style="font-family: Arial; font-size: 16px">'''Questions'''</span>= | =<span style="font-family: Arial; font-size: 16px">'''Questions'''</span>= | ||
− | <span style="font-family: Arial; font-size: 16px">Are the test cases really similar?</span> | + | <span style="font-family: Arial; font-size: 16px">Are the test cases really similar? Moving the data out to a spreadsheet works if it is reasonably simple to construct a single control script, using the external data, to process all of the tests.</span> |
+ | |||
= <span style="font-family: Arial; font-size: 16px">'''Resolving Patterns'''</span>= | = <span style="font-family: Arial; font-size: 16px">'''Resolving Patterns'''</span>= | ||
<span style="font-family: Arial; font-size: 16px">Most recommended:</span> | <span style="font-family: Arial; font-size: 16px">Most recommended:</span> | ||
− | * <span style="font-size: 16px">[[ DATA-DRIVEN TESTING]]: this pattern is one of the most applied | + | * <span style="font-size: 16px">[[ DATA-DRIVEN TESTING]]: this pattern is one of the most applied in practice (even if nobody knows that it's a pattern!) </span> |
<span style="font-size: 16px">Other useful patterns:</span><br /> | <span style="font-size: 16px">Other useful patterns:</span><br /> | ||
− | * <span style="font-size: 16px">[[ | + | * <span style="font-size: 16px">[[DON'T REINVENT THE WHEEL]]: applying this pattern will help you develop reusable testware</span> |
− | * <span style="font-size: 16px">[[ REFACTOR THE TESTWARE]]: re-design the tests so that they are more efficient</span><br /><br /> | + | * <span style="font-size: 16px">[[REFACTOR THE TESTWARE]]: re-design the tests so that they are more efficient</span><br /><br /> |
<span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Issues]] / Back to [[Test Automation Issues]]</span></div> | <span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Issues]] / Back to [[Test Automation Issues]]</span></div> |
Latest revision as of 10:27, 6 September 2018
Issue summary
Test cases repeat the same actions on different data
Category
Design
Examples
A number of automated test cases are doing basically the same test, but using different data values. To test an ordering system, for instance, you have tests for different types of customer (new, existing, bad credit risk, etc) who order different types of things, different numbers of things at different values, different shipping options, etc. All of the tests have the same basic structure: enter a customer (name, address etc), items ordered, delivery option, and the sum that should be payable for that order.
If you have used capture replay, for example, each of these tests would be a separate script, but each script repeats the same basic control instructions, with the relevant data for the test within the test (programmers call this 'hard-coded' data). This approach guarantees high maintenance costs because these are BRITTLE SCRIPTS; they are repetitious because they all repeat (needlessly) the same instructions.
Questions
Are the test cases really similar? Moving the data out to a spreadsheet works if it is reasonably simple to construct a single control script, using the external data, to process all of the tests.
Resolving Patterns
Most recommended:
- DATA-DRIVEN TESTING: this pattern is one of the most applied in practice (even if nobody knows that it's a pattern!)
Other useful patterns:
- DON'T REINVENT THE WHEEL: applying this pattern will help you develop reusable testware
- REFACTOR THE TESTWARE: re-design the tests so that they are more efficient