Return-Path: Delivered-To: apmail-jakarta-jmeter-user-archive@www.apache.org Received: (qmail 66555 invoked from network); 5 Sep 2008 11:42:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2008 11:42:26 -0000 Received: (qmail 24092 invoked by uid 500); 5 Sep 2008 11:42:21 -0000 Delivered-To: apmail-jakarta-jmeter-user-archive@jakarta.apache.org Received: (qmail 24074 invoked by uid 500); 5 Sep 2008 11:42:21 -0000 Mailing-List: contact jmeter-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "JMeter Users List" Reply-To: "JMeter Users List" Delivered-To: mailing list jmeter-user@jakarta.apache.org Received: (qmail 24063 invoked by uid 99); 5 Sep 2008 11:42:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 04:42:21 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 72.14.220.153 as permitted sender) Received: from [72.14.220.153] (HELO fg-out-1718.google.com) (72.14.220.153) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 11:41:23 +0000 Received: by fg-out-1718.google.com with SMTP id 22so254427fge.1 for ; Fri, 05 Sep 2008 04:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=P/99Wdx2GKsnXJq/cbUR8DFWHo1hys46Bs+LY0g5iug=; b=oMfDIeciV1qy+kNteOxLLZrnuEnjbViJI+pVhwmAbXZWW8UdaApubyjBsvI1AlAy9K Ymg7Ms7jPosieyBSY3/20BYhbK5/kp7SWIMshdmXfrD6cqoYWpWRPw0s3yEmYfRQ7zz4 3GAQRSt+U4EUB8pI+Ix9yJiSfMQwMT9KeO9IA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ROa3Wmk0DlYJsrSEbZTUpYJZ8+WnU0ZyEzMiItYXGzvxUTsMRzY3UeDJNKGNUphNII QRKCNm0kkvsIThcDPxNx4bl7IuMBMlmeLGiOLBbucOJ7NVh1LBAkyIID7tI17rMO7Hjn yqVoZersUTplzk1O4dPjajJLV7U9/NREco4IU= Received: by 10.86.65.9 with SMTP id n9mr8669863fga.55.1220614896132; Fri, 05 Sep 2008 04:41:36 -0700 (PDT) Received: by 10.86.65.7 with HTTP; Fri, 5 Sep 2008 04:41:36 -0700 (PDT) Message-ID: <25aac9fc0809050441iacd813cu26470bcb149f4f8c@mail.gmail.com> Date: Fri, 5 Sep 2008 12:41:36 +0100 From: sebb To: "JMeter Users List" Subject: Re: while and xpath extraction In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org On 05/09/2008, James Hill wrote: > Hi all. > > I'm pretty sure this can be done - it rings a bell anyway from past jmeter > threads - but for the life of me I can't find any reference to it. > > I'm sending a SOAP request that causes the server to kick off an > asynchronous job. The next step is a request to retrieve some data based on > this response - send the request too early and the response doesn't contain > the data required for the xpath extractor that's a part of this retrieve > request. The most inelegant solution is the one currently employed - we put > in a constant timer that waits for the maximum time we've seen (through > trial and error) and then steps into the next request. Invariably it grabs > the right data, but the asynchronous job doesn't always take this long. In > fact sometimes it can be quite quick so for 20 of the 25 seconds the load > server is sitting there doing not much at all. > > I'd like to use an XPath Extractor to pick out the incorrect response each > time the request is sent and embed this in a while controller. As soon as > the response is the valid one we're looking for, the while loop exits and > the test moves on to the next step. > > Can this be done and if so how? The While Controller exits when its condition evaluates to the string "false", so you just need to define a variable (or function) that is initially not "false", but evaluates to "false" at the appropriate time. If you set the default value to "false", and arrange the XPath Extractor so it matches incorrect responses only, then this should do the trick. If it's tricky to generate the appropriate negative XPath expression, then look for the success indicator, and use javascript/jexl/beanshell to convert the variable to false, i.e. the script function condition would need to be something like "${XPATHVAR}" == "default" or equally "${XPATHVAR}" != "success" where "default" is the XPATH default value and "success" is the value returned for a successful response. > Regards, > > James. > --------------------------------------------------------------------- To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: jmeter-user-help@jakarta.apache.org