Re: How to grind a Wicket application

Joan Picanyol i Puig <[email protected]> Tue, 23 Sep 2014 10:24:15 +0200
Newsgroups gmane.comp.java.grinder.user
Message-ID <[email protected]>
* Rafael Barrera Oro <[email protected]> [20140922 20:22]:
> My goal is to use The Grinder to stress/load test a fairly big (3000 users
> aprox) Wicket application.

> For this i started by recording some basic usage using the chrome
> devtools and then generating a python file using the har2grinder
> python script (very basic usage, just navigating to the login screen
> and logging in to the application).
> 
> I've noticed in the agent logs that all the request result in a 400 bad
> request code, however, the final ammount of errors is zero, so i suspect i
> am making a basic mistake somewhere.
> 
> Anyway, i wanted to ask you if you had any experience in the subject (with
> or without exporting the HAR)

I'm unsure about what the har2grinder does, but grinder's default XSLT
for proxy recording-based python script generation does not fail the
tests on HTTP error codes (see
http://sourceforge.net/p/grinder/mailman/message/32111509/).

You could try modifying your script by overwriting HTTPRequest:

class MyHTTPRequest(HTTPRequest):
    def __init__(self, url):
        HTTPRequest.__init__(self)
        if url: self.url = url
        self.swallow = False

    def __init__(self, url, swallow=False):
        HTTPRequest.__init__(self)
        if url: self.url = url
        self.swallow = swallow

    def processResponse(self, response):
        if response.statusCode >= 400:
            msg = "%(url)s KO %(status)s: %(msg)s" % (
                    {
                    "status": response.getStatusCode(),
                    "msg": response.text, "url": response.effectiveURI}
                    )
            print(msg)
            log(msg)
            if not self.swallow: 
                raise Exception(response.text)

and using this version in those tests you wish to fail (assuming har2grinder
generates scripts similar to grinder's TCPProxy HTTP filter):

def createRequest(test, url, headers=None):
    """Create an instrumented HTTPRequest."""
    request = MyHTTPRequest(url=url)
    if headers: request.headers = headers
    test.record(request.GET)
    test.record(request.POST)
    test.record(request.PUT)
    test.record(request.DELETE)
    test.record(request.TRACE)
    test.record(request.HEAD)
    test.record(request.OPTIONS)
    return request



------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk