WebVerifyDataDigest Function

Action

Checks whether the Internet traffic that Silk Performer receives differs from the traffic that the Recorder captured during an earlier recording session. As the Recorder does, Silk Performer generates a digest containing information about the occurrence of each character, and compares the results with the digest generated by the Recorder. Using this function, it is possible to check whether Silk Performer receives the same data as the client application did during recording.

When verifying/parsing an HTML page that consists of multiple frames (HTML documents), you can specify which frame document to verify/parse by specifying the nDocNum parameter. By default (1) the top document (e.g. a frameset) is scanned. This applies to HTML pages that are retrieved through a page-level command like WebPageUrl or WebPageLink.

It is important to know that all parsing and verification functions must be specified before the Web API call for which the response data should be parsed/verified. You can specify multiple parse/verification functions before a Web API call. The order of the parse/verification functions is not relevant (Exception: WebParseDataBound and WebVerifyDataBound using the flag WEB_FLAG_SYNCHRON).

Include file

WebAPI.bdh

Syntax

WebVerifyDataDigest( in  sDigest     : string,
                     in  nDigestLen  : number optional,
                     in  nDifference : number optional,
                     in  nOptions    : number optional,
                     in  nDocNum     : number optional,
                     in  nSeverity   : number optional := SEVERITY_ERROR,
                     out nActDiff    : number optional) : boolean;

Return value

  • true if the parsing modifier was created successfully.

  • false otherwise.

Parameter Description
sDigest Digest generated by the Recorder. When the corresponding option in the Recorder Settings tab is enabled, the Internet Recorder generates a constant string called sDigest in the const section of the test script, which is suitable for this function.
nDigestLen Size of the digest generated by the Recorder (optional, default = STRING_COMPLETE).
nDifference Upper tolerance level for the response verification (optional). For each digest entry, this function calculates the difference between the Recorder and the Silk Performer digests. Finally, this function calculates the sum total of the differences of the Recorder and the Silk Performer digests. If this sum total is greater than the tolerance level you specified, Silk Performer reports it as an error. If you want to ensure that both the Recorder and the Silk Performer digests are compatible, you must specify a negative value (e.g.: -1). If you do not specify a value, or if you set it to zero, the default setting will be used instead.
nOptions (optional)
WEB_FLAG_DONT_FORCE_LOAD
Specify this option to enable caching for subsequent request. Note that this may lead to unpredictable behaviour, because the verification may only cover certain parts (which are loaded) of a page.
WEB_FLAG_ALL_RESPONSES
If this flag is specified all server responses are scanned (even redirection responses, which are normally not displayed by a browser).
WEB_FLAG_INCLUDE_EMBEDDED
If this flag is specified, even embedded documents can be specified by the nDocNum parameter. Normally the number of a document is defined by the occurrence of the source definition in an HTML document (src=...). If this flag is specified every embedded object increases this counter, which assigns higher numbers to subsequent frames.
WEB_FLAG_INCLUDE_HEADER
If this flag is specified the response header can also be verified.
WEB_FLAG_HEADER_ONLY
If this flag is specified only the response header is verified.
nDocNum Specifies the document to verify (optional). Specify WEB_DOC_ALL if you want to verify all documents. If this parameter is omitted, the first document gets verified. (see the above definition of FLAG_INCLUDE_EMBEDDED)
nSeverity Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
  • SEVERITY_SUCCESS: Success; no error (numerical value: 0)
  • SEVERITY_INFORMATIONAL: Informational; no error (numerical value: 1)
  • SEVERITY_WARNING: Warning; no error (numerical value: 2)
  • SEVERITY_ERROR: (Default) Error; simulation continues (numerical value: 3)
  • SEVERITY_TRANS_EXIT: Error; the active transaction is aborted (numerical value: 4)
  • SEVERITY_PROCESS_EXIT: Error; the simulation is aborted (numerical value: 5)
nActDiff The calculated difference between the Recorder and the Silk Performer digests.

Example

When capturing Internet traffic, the Recorder receives the following characters:

A A B B B C C C C E F F G G G

Therefore it generates the digest shown below.

A B C D E F G
2 3 4 0 1 2 3

When replaying the script, Silk Performer receives the following character stream from the server:

A A B A B C C C C E F F F F G

Silk Performer then generates the digest shown below.

A B C D E F G
3 2 4 0 1 4 1

The differences between the both digests are shown below.

A B C D E F G
1 1 0 0 0 2 2

In this case, the sum of differences is 6. Consequently, the first Web function call that follows the function call

WebVerifyDataDigest(sDigest, STRING_COMPLETE, 0);

reports an error. However, the first Web function call that follows the function call

WebVerifyDataDigest(sDigest, STRING_COMPLETE, 6);

does not report an error.

Example

const
  DATA_DIGEST_1 :=    "\h01420000000083F0AFF5FEF2FD01FEFBFF0300000000000000000000000000000000D201"

   "\h01009800010009003D00AC0009000500060003000100010002003C004B004C004B000200"

   "\h0500020001000A0002000400020001001200050003000400070009003A00050004000200"

   "\h02000200BB000E003C0049000F010700650036007100040038007900A700D600A3000100"

   "\h6800D000F200390005001A001C001B00";
dcltrans
  transaction TMain
  begin
    ...
    WebVerifyDataDigest(DATA_DIGEST_1, 160, 0, 0, 1, SEVERITY_ERROR);
    WebUrl("http://lab21/MSSoapSamples/State/Service/Rpc/IsapiVb/State.wsdl", 0.44);
    ...
  end TMain;