WebVerifyResponseData Function

Action

Checks whether the Internet traffic Silk Performer receives differs from the traffic the Recorder captured during a former 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.

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).

注: This function is obsolete. It can still be used, although it's recommended to use the WebVerifyDataDigest function instead.

Include file

WebAPI.bdh

Syntax

WebVerifyResponseData( in  sDigest     : string,
                       in  nDigestSize : number,
                       in  nDifference : number optional,
                       out nResult     : 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 in the const section of the test script a constant string called sDigest, suitable for this function.
nDigestSize Size of the digest generated by the Recorder.
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, for example, -1. If you do not specify this value, or if you set it to zero, the default setting will be used instead.
nResult Variable that receives the sum total of the differences between the Recorder and the Silk Performer digests (optional). If you specify a variable here, the subsequent low-level web function call will not return until the request has finished.

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

WebVerifyResponseData(sDigest, sizeof(sDigest), 0);

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

WebVerifyResponseData(sDigest, sizeof(sDigest), 6);

does not report an error.

Sample scripts

WebVerification01.bdf