[Http-webtest-general] Re: control the test flow in wtscript?
Brought to you by:
m_ilya,
richardanderson
From: <il...@ma...> - 2003-01-28 16:48:36
|
>>>>> "UB" == u burghardt <u.b...@gm...> writes: UB> Hi, UB> is there an elegant solution for controlling the test flow within a UB> wtscript? UB> Is it possible to skip testcases or explicitely to define the successor UB> testcase? UB> I want to run dynamic tests whereby the sequence of testcases may vary UB> depending on a response. UB> in a wtscript there are 6 tests listed: A, B, C, D, E, F UB> in general these tests run in this sequence UB> is it possible to define a test flow like UB> A, B, C (if X then D else E, F) UB> X may be computed in a on_response hook UB> if this is not possible (yet) I would try to implement theses tests UB> splitting the flow into three scripts ((A,B,C), (D), (E,F)) UB> and managing the flow in the calling perl script... UB> just another (related) question: No, currently HTTP-WebTest doesn't have builtin support for such control of test flow. Though splitting test case into parts will work. UB> <example_code> UB> $webtest->run_wtscript('case1'); UB> my $content = $webtest->current_response->content; UB> my ( $Next_Start_URL ) = $content =~ /action='(.+?)'/; UB> if ( $content =~ /something/ ) { UB> $webtest->run_wtscript('case2.1'); UB> } UB> else { UB> $webtest->run_wtscript('case2.2'); UB> } UB> </example_code> UB> is there a possibility to make the $Next_Start_URL UB> available in the lateron called wtscripts case2.1 UB> or case2.2? You can use global vars to pass this information into the next test case: test_name = N/A url = "$main::Next_Start_URL" end_test this example assumes that $Next_Start_URL is declared in package main and it is a global var (i.e. not 'my'). -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |