Difference between revisions of "VERIFY-ACT-VERIFY"

From Test Automation Patterns
Jump to navigation Jump to search
(Created page with "<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.........................................................................................")
 
 
(3 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 Patterns]] / Back to [[Test Automation Patterns]]</span>
 
<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span>
=<span style="font-size: 16px">Pattern summary [*]]</span>=
+
=<span style="font-size: 16px">'''Pattern summary''' [*]</span>=
 
<span style="font-size: 16px">The action to test is surrounded by two verifications that check the initial and final state (pre- and post-conditions).</span><br /> <span style="font-size: 16px">This pattern ensures that a test actually checks whether a function works as expected, and a failure isn't due to some other factor (e.g. data consistency during creation / update or deletion of objects).</span>
 
<span style="font-size: 16px">The action to test is surrounded by two verifications that check the initial and final state (pre- and post-conditions).</span><br /> <span style="font-size: 16px">This pattern ensures that a test actually checks whether a function works as expected, and a failure isn't due to some other factor (e.g. data consistency during creation / update or deletion of objects).</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-size: 16px">Context</span>=
+
=<span style="font-size: 16px">'''Context'''</span>=
 
<span style="font-size: 16px">This pattern is especially useful for long term automation, but it can be used also for short lived tests.</span><br /> <br /> <span style="font-size: 16px">Note that if you do a [[FRESH SETUP]] for every test case you will not really need this pattern since you supposedly set up consistent initial conditions</span>
 
<span style="font-size: 16px">This pattern is especially useful for long term automation, but it can be used also for short lived tests.</span><br /> <br /> <span style="font-size: 16px">Note that if you do a [[FRESH SETUP]] for every test case you will not really need this pattern since you supposedly set up consistent initial conditions</span>
=<span style="font-size: 16px">Description</span>=
+
=<span style="font-size: 16px">'''Description'''</span>=
 
<span style="font-size: 16px">Using this pattern lets you ensure that the function you are testing actually works in the desired way. The pattern reminds you to check that the tested action triggers the right state transition. A test without verifications may not detect a problem if e.g. the steps to perform an action were successful but the action itself wasn’t (e.g. the individual actions to create a customer were successful, but the saving to the database failed).</span>
 
<span style="font-size: 16px">Using this pattern lets you ensure that the function you are testing actually works in the desired way. The pattern reminds you to check that the tested action triggers the right state transition. A test without verifications may not detect a problem if e.g. the steps to perform an action were successful but the action itself wasn’t (e.g. the individual actions to create a customer were successful, but the saving to the database failed).</span>
=<span style="font-size: 16px">Implementation</span>=
+
=<span style="font-size: 16px">'''Implementation'''</span>=
 
<span style="font-size: 16px">The action to test in the test case is surrounded by two verifications that check the initial and the final state (verify-act-verify).</span><br /> <span style="font-size: 16px">The advantages of using this pattern are:</span><br />  
 
<span style="font-size: 16px">The action to test in the test case is surrounded by two verifications that check the initial and the final state (verify-act-verify).</span><br /> <span style="font-size: 16px">The advantages of using this pattern are:</span><br />  
 
 
* <span style="font-size: 16px">Higher detection rate of defects in functions </span>
 
* <span style="font-size: 16px">Higher detection rate of defects in functions </span>
 
* <span style="font-size: 16px">Well-structured test cases --> Tester cannot forget a verification</span>
 
* <span style="font-size: 16px">Well-structured test cases --> Tester cannot forget a verification</span>
 
* <span style="font-size: 16px">Easy to use</span>
 
* <span style="font-size: 16px">Easy to use</span>
 
<br /> <span style="font-size: 16px">Examples:</span><br />  
 
<br /> <span style="font-size: 16px">Examples:</span><br />  
 
 
* <span style="font-size: 16px">Create a new user</span>
 
* <span style="font-size: 16px">Create a new user</span>
 
** <span style="font-size: 16px">Verify that the user does not already exist</span>
 
** <span style="font-size: 16px">Verify that the user does not already exist</span>
Line 28: Line 26:
 
** <span style="font-size: 16px">Delete the user</span>
 
** <span style="font-size: 16px">Delete the user</span>
 
** <span style="font-size: 16px">Verify that the user is deleted</span>
 
** <span style="font-size: 16px">Verify that the user is deleted</span>
=<span style="font-size: 16px">Potential problems</span>=
+
=<span style="font-size: 16px">'''Potential problems'''</span>=
 
 
 
* <span style="font-size: 16px">May not applicable for every type of use case (e.g. testing search functions may not be suitable for VAV)</span>
 
* <span style="font-size: 16px">May not applicable for every type of use case (e.g. testing search functions may not be suitable for VAV)</span>
 
* <span style="font-size: 16px">May increase the size and execution length of tests that require relatively complex verifications for simple actions </span>
 
* <span style="font-size: 16px">May increase the size and execution length of tests that require relatively complex verifications for simple actions </span>
=<span style="font-size: 16px">Issues addressed by this pattern</span>=
+
=<span style="font-size: 16px">'''Issues addressed by this pattern'''</span>=
 
''<span style="font-size: 16px">[[FALSE PASS]]</span>''<br /> ''<span style="font-size: 16px">[[FLAKY TESTS]]</span>''
 
''<span style="font-size: 16px">[[FALSE PASS]]</span>''<br /> ''<span style="font-size: 16px">[[FLAKY TESTS]]</span>''
=<span style="font-size: 16px">Experiences</span>=  
+
=<span style="font-size: 16px">'''Experiences'''</span>=  
<span style="font-size: 16px">If you have used this pattern, please add your name and a brief story of how you used this pattern: your context, what you did, and how well it worked - or how it didn't work!</span><br /> <span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span><br /> <br /> <span style="font-size: 14px">[*]] This pattern was suggested by the testing team at BREDEX - Thanks very much!</span></div>
+
 
 +
<span style="font-size: 16px">If you have used this pattern and would like to contribute your experience to the wiki, please go to [[Feedback]] to submit your experience or comment.</span><br /> <br />
 +
 
 +
 
 +
<span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span><br /> <br /> <span style="font-size: 14px">[*] This pattern was suggested by the testing team at BREDEX - Thanks very much!</span></div>

Latest revision as of 16:00, 21 August 2018

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

Pattern summary [*]

The action to test is surrounded by two verifications that check the initial and final state (pre- and post-conditions).
This pattern ensures that a test actually checks whether a function works as expected, and a failure isn't due to some other factor (e.g. data consistency during creation / update or deletion of objects).

Category

Design

Context

This pattern is especially useful for long term automation, but it can be used also for short lived tests.

Note that if you do a FRESH SETUP for every test case you will not really need this pattern since you supposedly set up consistent initial conditions

Description

Using this pattern lets you ensure that the function you are testing actually works in the desired way. The pattern reminds you to check that the tested action triggers the right state transition. A test without verifications may not detect a problem if e.g. the steps to perform an action were successful but the action itself wasn’t (e.g. the individual actions to create a customer were successful, but the saving to the database failed).

Implementation

The action to test in the test case is surrounded by two verifications that check the initial and the final state (verify-act-verify).
The advantages of using this pattern are:

  • Higher detection rate of defects in functions
  • Well-structured test cases --> Tester cannot forget a verification
  • Easy to use


Examples:

  • Create a new user
    • Verify that the user does not already exist
    • Create the user
    • Verify that the new user exists
  • Update an existing user account
    • Verify that the user does not already exist
    • Create the user
    • Verify that the new user exists
  • Delete a user
    • Verify that the user already exists
    • Delete the user
    • Verify that the user is deleted

Potential problems

  • May not applicable for every type of use case (e.g. testing search functions may not be suitable for VAV)
  • May increase the size and execution length of tests that require relatively complex verifications for simple actions

Issues addressed by this pattern

FALSE PASS
FLAKY TESTS

Experiences

If you have used this pattern and would like to contribute your experience to the wiki, please go to Feedback to submit your experience or comment.


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

[*] This pattern was suggested by the testing team at BREDEX - Thanks very much!