Skip to main content Skip to navigation

Web Sign On

Web Sign On "Signing in ..." form appearing inconsistently during load testing

You need to be logged in to post in this topic.
  1. I have some load testing code which signs in and then sets off a number of threads visiting a page. It uses httpunit to post the URL and get a response. Sometimes the response is the page I’m expecting first time, and sometimes it’s the “Signing in …” page. For example, running 4 concurrent threads, the “Signing in …” page might be encountered 2 or 3 times. I managed to get my test working by posting the form on the “Signing in …” page whenever I encounter it – when I ran 8 concurrent threads, I needed to post the form 13 times. I would like to understand why sometimes I get this form and sometimes I don’t. Here’s a code snippet: ********** WebConversation webConv = new WebConversation(); ... WebResponse resp = login(webConv); String urlString = new String(“ http://test-mrm.warwick.ac.uk/mrm/staff/mainMenu.htm” ;); ... resp = webConv.getResponse(urlString); // when I ran this 4 times concurrently, I found it failed one of the times. // Attempting to fix this by automatically posting the form when I get the Signing in page. while (resp.getTitle().equals(“Signing in…”)) { //Thread.sleep(1); resp = webConv.getCurrentPage(); System.err.println(“posting signing in form …”); WebForm form = resp.getFormWithID(“shibboleth”); assertNotNull(form); form.submit(); resp = webConv.getCurrentPage(); } WebForm form = resp.getFormWithID(“studentForm”); assertNotNull(form); ** The login method looks like this: private WebResponse login(WebConversation webConv) throws SAXException, IOException, SingleSignOnException { String urlString = new String(“ http://test-mrm.warwick.ac.uk/mrm/staff/mainMenu.htm” ;); SingleSignOnHelper ssoHelper = new SingleSignOnHelper(); URL url = new URL; return ssoHelper.signIn(webConv, url, “XXXXX”, “XXXXXXX”);
     
  2. Re: "Signing in ..." form appearing inconsistently during load testing
    Are these threads all using the same cookie store? If they are then I would expect sessions to get invalidated all over the place, the same as you would expect if you had multiple tabs in one browser all signing in at once. I’d first check that the HttpUnit state is totally separate between threads. When posting code, could you start and end with a line of three backward slashes, like this: \\\ while (resp.getTitle().equals(“Signing in…”)) { resp = webConv.getCurrentPage(); } \\\ Cheers Nick
     
  3. Re: "Signing in ..." form appearing inconsistently during load testing
    > Are these threads all using the same cookie store? Any ideas on how I might tell? Paul Strapps points out that each thread creates a new WebConversation instance, so would assume not. You mentioned you run a similar load test of SSO – is your set up differently?
     
  4. Re: "Signing in ..." form appearing inconsistently during load testing
    > Any ideas on how I might tell? You could log the cookies being sent/received with each request and compare them, or you could run the code in a debugger, set a breakpoint and inspect the variables for each thread to see if the cookie store is the same object. I’d start with the logging, since it’s likely to be informative, whether or not the root cause is a non thread-safe HTTP client.
     
  5. Re: "Signing in ..." form appearing inconsistently during load testing
    Each time you sign in to SSO it generates a login ticket for you. When the same usercode signs in to the same application, you get a new one and the old one is invalidated. What’s happening here is that threads are overwriting each other’s tickets. You will need N separate usercodes for load testing with N threads in orderly to properly simulate a lot of users logging in. You can do this simply by creating them in External Users, rather than using your own usercode which I’m sure you are already aware is not recommended for use in code.
     
  6. Re: "Signing in ..." form appearing inconsistently during load testing
    All is explained, thanks for your help. :)
     
  7. Re: "Signing in ..." form appearing inconsistently during load testing
    I hadn’t really explained why you kept getting the “Signing in…” message. What HttpUnit will have been doing is posting the hidden form to your shire – your app’s shire would then use the ticket to request user attributes, but by this time the ticket’s invalid so there are no user attributes, and the app’s ForceLoginFilter redirects back to Websignon which sends you straight back to the hidden “Signing in…” form, and the process repeats until the timing of the other threads means it can get the user attributes with a valid ticket. More threads means the ticket’s more likely to be invalidated, so it takes more attempts.
     
  8. Re: "Signing in ..." form appearing inconsistently during load testing
    OK, thanks. I think this means my testing is on hold for a bit until I can figure out a way to create multiple users with suitable permissions to test my app. (Originally I was able to create them in membership but a Grails issue has caused that to stop working, hence the reversion to logging in as me.)
     

Are you sure?

Are you sure?

Forum followers

Follower data is not currently available.

Search results