EXTRA_CFLAGS=-fno-strict-aliasing -I/usr/lib/perl5/5.6.0/i386-linux/CORE -I. -I../.. -DUSE_PERL_SSI -fno-strict-aliasing -DMOD_PERL -DSECURITY_HOLE_PASS_AUTHORIZATION
Include/apache/httpd.conf
export WEBTST_HOME=/home/rosa/works/perl/webtst export WEBTST_GROUP_ID=507
test smoke rosa /osoTests/critter/dev/ getCookiesInLoginLogout suite smoke rosa /home/webtst/suites/acs.suite .*
). This is a very loose format ideal for translation of XML files into perl structures. This means that although you have to follow a syntax, you can pretty much stuff whatever you want into it. The format does not enforce semantic restrictions and therefore you should probably know what is needed if you decide to handcode one of these recording files. The web interface should deal nicely with the creation of these files.
The format for these files follows the DTD:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE perldata [ <!ELEMENT perldata (hash)> <!ELEMENT hash (item*)> <!ELEMENT array (item*)> <!ELEMENT item (#PCDATA|hash|array)*> <!ATTLIST item key CDATA #REQUIRED> ]>
The file will map to a hash from which fields are extracted. These are:
The following link leads to an example of a recording file.
Back to top
Test Id | Description | TEST_PARAM1 | TEST_PARAM2 |
---|---|---|---|
ACCESS | Check if the page can be accessed. | Unused | Unused |
TITLE_SUCCESS | Success if the returned page title matches a specified pattern. | A perl regular expression for title matching (e.g. Francisco.*Rosa) | Unused |
TITLE_FAIL | Failure if the returned page title matches a specified pattern. | A perl regular expression for title matching (e.g. Francisco.*Rosa) | Unused |
TIME | Success if the time to process the requests falls within the specified range. | The lower limit for the time range (e.g. 2, as in 2 seconds). | The higher limit for the time range (e.g. 30, as in 30 seconds). |
PAGE_DIFF | Success if the retrieved content matches bit by bit the stored content at recording session time. | Unused | Unused |
CUSTOM_TEST | Allow running a user-built custom test. | The perl module, accessible from the running environment where the run method can be found. | The parameters to the test execution. |
CONTENT_PATTERN_SUCCESS | Success if the retrieved content matches the specified regular expression. | A perl regular expression to match the content against (e.g. Francisco.*Rosa) | Unused |
CONTENT_PATTERN_FAIL | Failure if the retrieved content matches the specified regular expression. | A perl regular expression to match the content against (e.g. Francisco.*Rosa) | Unused |
STATUS_SUCCESS | Success if the status of the request execution matches given status id. | Numeric status for success of test (e.g. 401, 200) | Unused |
STATUS_FAIL | Failure if the status of the request execution matches given status id. | Numeric status for success of test (e.g. 401, 200) | Unused |
COOKIE_SET_PATTERN_SUCCESS | Success if the execution of the request results in the specified cookie being set with the specified value. | Name of the cookie being set. | A perl regular expression to match the cookie value against. |
TEST_SEQUENCE | Allows running a sequence of tests against returned request. Successfull if all tests are successfull, failure if any one of the tests fails. | A sequence of tests following the syntax: TestID[TEST_PARAM1|TEST_PARAM2](;TestID[TEST_PARAM1|TEST_PARAM2])*. Example: COOKIE_SET_PATTERN_SUCCESS[critter_javascript|.*?Ingenta TEST.*?];ACCESS[];TITLE_SUCESS[Francisco]). | Unused |
SUBTEST_CALL | Run a full subtest when hitting this step. Effectively allows reuse of defined tests. | The subtest folder. | The subtest name. |
return new TestResult(<itemResult>,<testType>,<testStepDuration>,<resultMessage>);Where:
package varSet_FirstMatch; use strict; # Custom test run method sub run { my ($testParams) = @_; my $recordingName = $testParams->{"RECORDING_NAME"}; my $testItem = $testParams->{"TEST_ITEM"}; my $testDuration = $testParams->{"TEST_DURATION"}; my $request = $testParams->{"TEST_REQUEST"}; my $response = $testParams->{"TEST_RESPONSE"}; my $feedbackLineMethod = $testParams->{"FEEDBACK_METHOD"}; my $testType = $testItem->{"TEST_TYPE"}; my $paramList = &Utils::unescapeXML($testItem->{"TEST_PARAM2"}); my $variableStore = $testParams->{"VARIABLE_STORE"}; # get content from step response my $newContentText = ${$response->content_ref()}; # split parameters to get variable name and pattern to match my @paramArray = split(",",$paramList); if ( @paramArray != 2 ) { return new TestResult("FAIL",$testType,$testDuration,"varSet_FirstMatch requires exactly 2 parameters, got: >>$paramList<<"); } # get variable name my $varName = $paramArray[0]; # get pattern expression my $matchExpression = $paramArray[1]; # try matching my $firstMatch = ""; if ( (($firstMatch) = ($newContentText =~ m@$matchExpression@is)) ) { # Success, store and return $variableStore->{$varName} = $firstMatch; return new TestResult("OK",$testType,$testDuration,"varSet_FirstMatch assigned $firstMatch to var: $varName"); } else { # Failure, could not match return new TestResult("FAIL",$testType,$testDuration,"varSet_FirstMatch failed setting var: >>$varName<<, when matching: >>$matchExpression<< in content."); } } 1;