• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Authentication

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

We are maintaing list of usernames and passwords for my application, I need to write Http Unit testcases for login page.

how do i write , help me

Regards,
pp
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A login page is an HTML form like any other, so you'd write a test case for it like you'd do with any HTML form page. Or does the problem have to do wtih retrieving usernames/passwords? If so, tell us in more detail what you have so far, and where you're stuck making progress.
 
Pen Pentela
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
A login page is an HTML form like any other, so you'd write a test case for it like you'd do with any HTML form page. Or does the problem have to do wtih retrieving usernames/passwords? If so, tell us in more detail what you have so far, and where you're stuck making progress.




My code is below

WebConversation wc = new WebConversation();
WebResponse wr = wc.getResponse(URL);
WebForm[] form = wr.getForms();
form[0].setParameter("userName","administartor");
form[0].setParameter("pass","password");
WebResponse rs1 = form[0].submit();
assertEquals("Page Title","Menu",rs1.getTitle());

this is static working properly. Here I checked with only one username administrator, but we are having multiple usernames , to check multiple usenames with respective passwords how do i write , please suggest me ,

Best Regards,
PP
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be uncommon to test with more than one user. If one particular user can log in with a valid password, then so should all other ones.

One other test I'd add is to check the login with a non-admin user, and to make sure that he gets a different page (or one that's missing whatever additional options an admin sees).
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
It would be uncommon to test with more than one user. If one particular user can log in with a valid password, then so should all other ones.



To reformulate that into a question: why do you want to test with several user names? What problems might testing with several user names uncover that testing with just one name will not?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with the above posters that there is no point in testing multiple users unless something is different. Such as having different roles/levels of access.

To do that you would logout (or better yet, create a new test and web conversation) and test with the next user.
 
Pen Pentela
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
I agree with the above posters that there is no point in testing multiple users unless something is different. Such as having different roles/levels of access.

To do that you would logout (or better yet, create a new test and web conversation) and test with the next user.



We are having multiple users with different roles .
 
reply
    Bookmark Topic Watch Topic
  • New Topic