Difference between revisions of "DATE INDEPENDENCE"
Jump to navigation
Jump to search
m (Put topic titles in capital letters) |
|||
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">Write your test cases to be date independent</span> | <span style="font-size: 16px">Write your test cases to be date independent</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">Use this pattern if your test cases or your expected results have some dependency on dates</span> | <span style="font-size: 16px">Use this pattern if your test cases or your expected results have some dependency on dates</span> | ||
− | =<span style="font-size: 16px">Description</span>= | + | =<span style="font-size: 16px">'''Description'''</span>= |
<span style="font-size: 16px">If possible redesign your test cases (or expected results) to avoid [DATE DEPENDENCY]. If this is not possible, you must set the initial conditions accordingly</span> | <span style="font-size: 16px">If possible redesign your test cases (or expected results) to avoid [DATE DEPENDENCY]. If this is not possible, you must set the initial conditions accordingly</span> | ||
=<span style="font-size: 16px">Implementation</span>= | =<span style="font-size: 16px">Implementation</span>= | ||
<span style="font-size: 16px">Here some suggestions on how to implement this pattern:</span><br /> | <span style="font-size: 16px">Here some suggestions on how to implement this pattern:</span><br /> | ||
− | |||
* <span style="font-size: 16px">ask developers to use the current date as default in the date fields, then you don't have to use it your scripts</span> | * <span style="font-size: 16px">ask developers to use the current date as default in the date fields, then you don't have to use it your scripts</span> | ||
* <span style="font-size: 16px">calculate the dates that you need by adding or subtracting the wanted difference from the current date</span> | * <span style="font-size: 16px">calculate the dates that you need by adding or subtracting the wanted difference from the current date</span> | ||
Line 17: | Line 16: | ||
* <span style="font-size: 16px">ask developers to build a switch that you can use to block showing date & time on outputs</span> | * <span style="font-size: 16px">ask developers to build a switch that you can use to block showing date & time on outputs</span> | ||
* <span style="font-size: 16px"><span style="font-size: 16px">use for comparisons </span>a tool that allows you to blot out the variable areas (date & time) on your outputs</span> | * <span style="font-size: 16px"><span style="font-size: 16px">use for comparisons </span>a tool that allows you to blot out the variable areas (date & time) on your outputs</span> | ||
− | =<span style="font-size: 16px">Potential problems</span>= | + | =<span style="font-size: 16px">'''Potential problems'''</span>= |
<span style="font-size: 16px">If you have changed the system date and for some reason a test doesn't run through, your machine will be running on a wrong date and you may not notice it immediately</span> | <span style="font-size: 16px">If you have changed the system date and for some reason a test doesn't run through, your machine will be running on a wrong date and you may not notice it immediately</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">[[DATE DEPENDENCY]]</span>'' | ''<span style="font-size: 16px">[[DATE DEPENDENCY]]</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></div> | <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></div> |
Revision as of 08:36, 4 May 2018
.................................................................................................................Main Page / Back to Design Patterns / Back to Test Automation Patterns
.................................................................................................................Main Page / Back to Design Patterns / Back to Test Automation Patterns
Pattern summary
Write your test cases to be date independent
Category
Design
Context
Use this pattern if your test cases or your expected results have some dependency on dates
Description
If possible redesign your test cases (or expected results) to avoid [DATE DEPENDENCY]. If this is not possible, you must set the initial conditions accordingly
Implementation
Here some suggestions on how to implement this pattern:
- ask developers to use the current date as default in the date fields, then you don't have to use it your scripts
- calculate the dates that you need by adding or subtracting the wanted difference from the current date
- in the setup procedure, set the system date to the date you are expecting (after you have saved the current date); after the test has been run set the current date back
- in the expected results use only date & time differences and not the actual dates
- ask developers to build a switch that you can use to block showing date & time on outputs
- use for comparisons a tool that allows you to blot out the variable areas (date & time) on your outputs
Potential problems
If you have changed the system date and for some reason a test doesn't run through, your machine will be running on a wrong date and you may not notice it immediately
Issues addressed by this pattern
Experiences
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!.................................................................................................................Main Page / Back to Design Patterns / Back to Test Automation Patterns