Pages: 1 2 4 5 ...6 ...7 8 9 10 11 12 ... 14

03/31/17

  10:13:00 am, by   , 315 words  
Categories: Uncategorized

Design Patterns in Test Automation: FuzzyVerify

In the last post, we discussed how design patterns can be used in test automation to reduce the level of effort to develop and maintain automated tests. Here is another useful design pattern:

Pattern Name: FuzzyVerify

Problem: Verification steps can be tricky when some part of an entity to be verified contains data that is difficult or impossible to predict. A portion of the text to be verified needs to be masked so that the predictable part of the data can be compared to the expected result. For example, date time stamps and system generated IDs are frequently included in character sequences that also contain data that needs to be validated. While custom validations can be written to parse out unpredictable parts of strings, it is a time-consuming process.

Solution: The solution to the problem must be able to mask out unpredictable parts of the target string in any position in which they might occur.

The following is a proposed solution:

Design Patterns in Test Automation: FuzzyVerify

 The solution assumes that the ExpectedResult parameter will include the ‘*’ in place of characters that should be masked out of the string comparison. The ‘*’ is a wildcard that also serves as a delimiter. It is used to separate the ExpectedResult into a list of strings that are expected to be part of the ActualResult. The loop provides a structure in which to validate that each of the sub-strings in the ExpectedResult are contained in the ActualResult. In this way, the unpredictable parts of the ActualResult are ignored.

Consequences:  In order for this pattern to be used successfully, the caller needs to properly delimit the expected result. If the mask is incorrectly applied, then the comparison will fail. On the other hand, the VerifyStingsWithMasking provides an easy way to build a fuzzy comparator with no application specific requirements. Once it is implemented in the test tool language, it can be reused in any situation.

1 2 4 5 ...6 ...7 8 9 10 11 12 ... 14

Zeenyx Software is committed to providing a solution for manual and automated testing that will allow all members of the team to build effective tests faster than with traditional manual testing methods so that a positive Return on Investment is achieved the very first time tests are deployed.

Search

  XML Feeds

blog engine