jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Provan <davepro...@hotmail.com>
Subject RE: Redirects on HTTP Request
Date Wed, 21 Jan 2009 21:44:52 GMT

Hi Adrian,

Thanks for your assistance today.  I eventually to get this work using the following tree

 -Simple Controller
   - While Loop (Checking if it can continue)
       - HTTP Request Sample
           - BeanShell Post Processor - Checks to see if redirect, if so continues the while
loop
   - Bean Shell Post Processor - Resets the continue for the next thing that needs to loop
so you can re-use the variable.

Thanks to everyone for their suggestions and assistance.

David Provan

> Subject: RE: Redirects on HTTP Request
> Date: Wed, 21 Jan 2009 16:56:59 +0000
> From: adrianf@revenue.ie
> To: jmeter-user@jakarta.apache.org
> 
> 
> Hi David,
> 
> The debug sampler will do the variable dump you describe. However ive just
> been messing with it and its not much help - I can see the variable values
> change in response to the beanshell processing, but the apparent change in
> value doesnt see to affect the outcome of the logic controllor condition
> evaluation!
> 
> - Adrian
> 
> -----Original Message-----
> From: David Provan [mailto:daveprovan@hotmail.com]
> Sent: 21 January 2009 16:52
> To: JMeter List
> Subject: RE: Redirects on HTTP Request
> 
> 
> 
> 
> Hi Adrian,
> 
> Thanks for replying.  I *think* (Only think as I am no expert in this) I
> agree with you, I have another section to call after this first redirect pile
> which will also redirect.  I have created a Simple Controller to isolate
> these into different trees so I can actively set UDV's for each simple
> controller section.  However I get the feeling that the ContinueLoop value is
> being read by the next While loop using the value from the completed previous
> one.
> 
> Is there a way in JMeter to invoke a "dump" of variables at various points as
> the test runs through the tree?
> 
> For instance "Before this HTTP sample, these are the variables I have
> stored...."
> 
> Thanks in advance to anyone who can help.
> 
> David Provan
> 
> 
> > Subject: RE: Redirects on HTTP Request
> > Date: Wed, 21 Jan 2009 16:46:15 +0000
> > From: adrianf@revenue.ie
> > To: jmeter-user@jakarta.apache.org
> > 
> > 
> > Hi David,
> > 
> > Im afraid im not entirely sure whats wrong here. I think it something to do
> > with the change of value of the loop controller variable that you doing
> > within the beanshell not be picked up by the logic check of the while loop.
> > Dont quite understand why this happens or exactly how to fix it through. I
> > think you may need to mess with how you have declared your loop controller
> > variable initally. Ive had this problem before with treating Jmeter as a
> > execution of producal logic, but thats not exactly how it behaves! Perhaps
> > someone else can shed some light on this???
> > 
> > Regards,
> > 
> > Adrian
> > 
> > -----Original Message-----
> > From: David Provan [mailto:daveprovan@hotmail.com]
> > Sent: 21 January 2009 16:11
> > To: JMeter List
> > Subject: RE: Redirects on HTTP Request
> > 
> > 
> > 
> > Hi Adrian
> > 
> > I think I have got most of this working however I am getting a strange
> error
> > now!
> > 
> > It runs through the redirect and then simply "goes Bananas with the View
> Tree
> > Results, I get a stack full of Simulated Site User lines in the tree (My
> > transaction controller for the test) and the log fills with tonnes of these
> > lines over and over again (the top of the trace is also here).  The overall
> > trace is a couple of thousand lines...
> > 
> >     at
> >
> org.apache.jmeter.control.GenericController.next(GenericController.java:143)
> >     at
> >
> org.apache.jmeter.control.TransactionController.next2(TransactionController.j
> > ava:153)
> >     at
> >
> org.apache.jmeter.control.TransactionController.next(TransactionController.ja
> > va:86)
> >     at
> >
> org.apache.jmeter.control.GenericController.nextIsAController(GenericControll
> > er.java:180)
> >     at
> >
> org.apache.jmeter.control.GenericController.next(GenericController.java:143)
> > 
> > Top lines
> > 
> > 2009/01/21 16:04:57 ERROR - jmeter.threads.JMeterThread: Test failed!
> > java.lang.StackOverflowError
> >     at java.awt.Font.equals(Unknown Source)
> >     at sun.font.FontDesignMetrics$MetricsKey.equals(Unknown Source)
> >     at java.util.HashMap.get(Unknown Source)
> >     at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
> > 
> > It's as if the thing isn't breaking out of the loop, however I am setting
> my
> > variable to kick that out.
> > 
> > Here is the pre-processor I have written, apologies if it isn't perfect I
> am
> > new to JMeter!
> > 
> > import java.util.regex.*; 
> > 
> > log.info("** TESTING ** - BSPP - Analysing response from service");
> > 
> > if(prev.getResponseCode().equals("302") ||
> > prev.getResponseCode().equals("301")){
> >    log.debug("** Arcadia ** - Handling 302 redirect");
> >    String pStr = "Location:
> > http://www.topshop.com([a-zA-Z0-9/?&%=\\-_\\.\\,]*)";
> > 
> >    log.debug(" ** TESTING ** - Using regex of " + pStr);
> > 
> >    Pattern idPattern = Pattern.compile(pStr, Pattern.MULTILINE);
> >    Matcher idMatcher = idPattern.matcher(prev.getResponseHeaders());
> > 
> >    boolean matched = idMatcher.find();
> > 
> >    if (matched) {
> >       log.debug("** TESTING ** - Match for URL has been found");
> >       log.info("** TESTING ** - Extracted URL of: " + idMatcher.group(1));
> >       vars.put("Add_Url", idMatcher.group(1));
> >    }
> > } else if(prev.getResponseCode().equals("200")){
> >    log.info("** TESTING ** - 200 OK Response received, cancelling loop");
> >    vars.put("ContinueLoop", "false");
> >    log.info("** TESTING ** - Updated to be: " + vars.get("ContinueLoop"));
> > }
> > 
> > I am happy to admit I have made a mistake, problem is I don't know where my
> > mistake is at the moment.
> > 
> > Thanks in advance for any help.
> > 
> > David Provan
> > 
> > > Subject: RE: Redirects on HTTP Request
> > > Date: Tue, 20 Jan 2009 18:50:43 +0000
> > > From: adrianf@revenue.ie
> > > To: jmeter-user@jakarta.apache.org
> > > 
> > > 
> > > Hi David,
> > > 
> > > Interesting question! I haven't tried this, but it might be possible to
> > > achieve this something like:
> > > 
> > > - Put each HTTP request sampler which can have redirects in a while loop
> > > controller, with a boolean flag controlling whether the loop should be
> > > execute. Intially set this flag to TRUE
> > > - Set the server part of the URL for the sampler to the correct server
> > > address, and the path part to a variable - say call it URL_PATH.
> Initialise
> > > URL_PATH to the initial path - "/someapp/servlet" per your example
> > > - Add a bean shell post processor (BSPP) to the sampler. The BSPP should
> > > check the response from the sample to see if it a redirect. If so, it
> > should
> > > update URL_PATH to the redirect location. If not, the BSPP should set the
> > > loop control variable to FALSE
> > > 
> > > I THINK this structure would allow to follow redirects on the same server
> > to
> > > an infinite depth. Its fairly convoluted, so there may well be a much
> > easier
> > > way! However, once you have it working for 1 URL, it should be the same
> for
> > > all others.
> > > 
> > > Let me know how you get on!
> > > 
> > > - Adrian
> > > 
> > > -----Original Message-----
> > > From: David Provan [mailto:daveprovan@hotmail.com]
> > > Sent: 20 January 2009 17:28
> > > To: JMeter List
> > > Subject: RE: Redirects on HTTP Request
> > > 
> > > 
> > > 
> > > Hi,
> > > 
> > > I considered this, however the product we're testing against can throw 1
> to
> > n
> > > redirects (the largest number I have seen so far is 7 in a row).
> Otherwise
> > > that would work nicely!
> > > 
> > > For example
> > > 
> > > /someapp/servlet redirects to /someapp/another_servlet redirects to
> > > /someapp/next_servlet redirects to /someapp/final_servlet
> > > 
> > > Thanks
> > > 
> > > David.
> > > 
> > > > Subject: RE: Redirects on HTTP Request
> > > > Date: Tue, 20 Jan 2009 12:24:25 -0500
> > > > From: Steve.Kapinos@tandberg.com
> > > > To: jmeter-user@jakarta.apache.org
> > > > 
> > > > Why not follow the redirect manually rather then automatically?
> Extract
> > > > the path from the response header with regex and feed that as your path
> > > > into the next sample.  How can Jmeter know which server you want to
> hit?
> > > > You need to tell it explicitly.
> > > > 
> > > > -----Original Message-----
> > > > From: David Provan [mailto:daveprovan@hotmail.com] 
> > > > Sent: Tuesday, January 20, 2009 12:17 PM
> > > > To: JMeter List
> > > > Subject: Redirects on HTTP Request
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I am using HTTP Request nodes to sample against a site however we have
> > > > come accross an issue when redirecting.
> > > > 
> > > > I have multiple HTTP Servers so to ensure I "hit" the correct one I use
> > > > the HTTP Header Manager to set a "Host" attribute in the HTTP Request
> > > > sample set the IP address to hit
> > > > 
> > > > e.g. http://1.2.3.4/some/servlet
> > > > 
> > > > The code I am hitting then sends a redirect which JMeter will
> > > > automatically follow, however the returning redirect contains the host
> > > > not the IP address so I no longer can be sure of the web server I am
> > > > testing against.
> > > > 
> > > > For example.
> > > > 
> > > > I request http://1.2.3.4/some/servlet (Host: header set to
> > > > www.example.com).
> > > > 
> > > > This returns a redirect of http://www.example.com/its/moved/to/here.
> > > > 
> > > > Is it possible in JMeter to replace the returned www.example.com in the
> > > > redirect URL with the IP address?
> > > > 
> > > > Thanks in advance for any assistance.
> > > > 
> > > > David Provan
> > > > 
> > > > _________________________________________________________________
> > > > Choose the perfect PC or mobile phone for you
> > > > http://clk.atdmt.com/UKM/go/130777504/direct/01/
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > > > 
> > > 
> > > _________________________________________________________________
> > > Are you a PC?  Upload your PC story and show the world
> > > http://clk.atdmt.com/UKM/go/122465942/direct/01/
> > > 
> > > ************************
> > > 
> > > This message has been delivered to the Internet by the Revenue Internet
> > e-mail service (OP)
> > > 
> > > *************************
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > > 
> > 
> > _________________________________________________________________
> > Are you a PC?  Upload your PC story and show the world
> > http://clk.atdmt.com/UKM/go/122465942/direct/01/
> > 
> > ************************
> > 
> > This message has been delivered to the Internet by the Revenue Internet
> e-mail service (OP)
> > 
> > *************************
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> > 
> 
> _________________________________________________________________
> Cut through the jargon: find a PC for your needs.
> http://clk.atdmt.com/UKM/go/130777504/direct/01/
> 
> ************************
> 
> This message has been delivered to the Internet by the Revenue Internet e-mail service
(OP)
> 
> *************************
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
> 

_________________________________________________________________
Imagine a life without walls.  See the possibilities
http://clk.atdmt.com/UKM/go/122465943/direct/01/
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message