Difference between revisions of "REPETITIOUS TESTS"

From Test Automation Patterns
Jump to navigation Jump to search
m (empty lines removed)
Line 2: Line 2:
 
=<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">Test cases have the same structure, for instance entering a customer with his address, but use different values</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]]. </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 on the field (even if nobody knows that it's a pattern!) </span>
+
* <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">[[DON'T REINVENT THE WHEEL]]: applying this pattern will help you develop reusable testware</span>
 
* <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>

Revision as of 10:26, 6 September 2018

.................................................................................................................Main Page / Back to Design Issues / Back to Test Automation Issues

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.

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:

.................................................................................................................Main Page / Back to Design Issues / Back to Test Automation Issues