How can I perform verification on the server response on BDF scripts recorded at TCP/IP level?
You cannot perform automatic verification using the point and click method in the TrueLog Explorer in the same manner as you would when replaying HTTP traffic. Therefore when replaying a BDF Script which uses the SilkPerformer TCP/IP functionality you will instead have to manually incorporate verification into the BDF script.
One method of doing this is as follows:
1) Identify using the TrueLog Explorer "In-Data" tab the text that you wish to perform verification on to ensure that it is always returned by the server.
2) Modify the recorded function "WebTcpipRecvExact" so that the server response will be stored in a variable in memory; you can do this by removing the NULL value from the second parameter and replacing it with a variable as follows:
Recorded: WebTcpipRecvExact(hWeb0, NULL, 979); Amended: WebTcpipRecvExact(hWeb0, sVar, 979);
3) Perform a string search on the contents of the variable for the "text" that you wish to verify is returned by the server, you can do this by using one of the string search functions in the SilkPerformer BDL; like the following:
nPos := StrSearch(sVar,"bea61home", STR_SEARCH_FIRST); Write (nPos); Writeln;
4) If the string is not present in the server response you can then raise a verification error which will be written to the Results Repository by using the RepMessage function, as follows:
In the above example I am checking to see if the position is less than 1, i.e it does not exist
Finally the whole segment of code should look like:
WebTcpipRecvExact(hWeb0, sVar, 979); nPos := StrSearch(sVar,"bea61home", STR_SEARCH_FIRST); Write (nPos); Writeln; if nPos