How do I stop recording a test in a Grinder script?

448 Views Asked by At

I'm writing a test script for a web application that relies on cookies for session management. The HTTPRequest handles the cookies brilliantly, as long as I stick to one request object.

The problem is that I can't get my tests to stop recording:

url = "http://site"
request = HTTPRequest(url=url)

...

Test(1, "Login").record(request)

...

Test(2, "Get index page").record(request)

This code works, but the statistics will show twice as many runs for the Login-test. The Test class (http://grinder.sourceforge.net/g3/script-javadoc/index.html) does not define an stopRecording method.

1

There are 1 best solutions below

0
On

Implemented work around:

def GETTest(request, testId, testName, path):
    newRequest = HTTPRequest()
    newRequest.setUrl(request.getUrl())
    newRequest.setHeaders(request.getHeaders())

    Test(testId, testName).record(newRequest)

    return newRequest.GET(path)

This fixes the statistics without breaking the session with the server.