One of the interviewer asked the below question:

Tell me the best positive and negative test cases for Login page.

Can anyone provide me with the best answer?

  • I found best login test case sample here : thesoftwaretesting.com/test-cases You can download from here. – Helping Hands Jul 24 '15 at 5:26
  • 1
    Did you ask the interviewer what "best" meant in this context? Without that, this question cannot be answered. – Joe Strazzere Aug 23 '15 at 12:32

10 Answers 10


Telling the interviewer what is less important than telling them why. They asked for the two best cases - not just a list of cases. This means that you need to explain to them why these cases are "better" than the many other cases you could have offered up. It doesn't matter if you give good answers if you cannot also explain why they are good answers.

A great place to start might be to ask what the interviewer means by "best". Does he or she mean, "Most valuable tests if only two tests are written"? "Most interesting"? "Most efficient at uncovering bugs"? "Most valuable in terms of time to implement"? These kinds of questions suggest that the interviewee understands that different people throughout the business may value different things. "Best" from the project owner's perspective may not be the same as "best" from the perspective of the technical lead or the business owner.

If the interviewer says, pick whatever definition of best makes sense to you (a common response):

The best positive case is generally the "Happy path" case - the most common case that will happen. If that test case passes, it tells you that your system is basically functioning for the main situation. It also is the test case that covers the broadest swath of the user experience. For this scenario, this would be a valid user logging in with a common username (no fancy characters) and a correct simple password (as simple as the security requirements will allow).

The best negative case, if time is limited, is nothing more than entering a simple username and an incorrect but also simple password. The basic functionality of a login page is to deny users with incorrect passwords, and that no other behavior matters if the login page cannot do this. If more time is available, I would say that the best test case is fuzzing the password field using any value other than the correct password for a given user, and then checking for successful logins, exceptions, and other inappropriate results. I would want to talk to the developers and business owners to determine what results would be inappropriate.

I personally would also volunteer to give some other interesting cases, to let the interviewer know that I can come up with, e.g., servers unavailable, edge cases in the registration process, SQL injection, tests to make sure the login process isn't too fast (allows attackers more attempts in less time).

Honestly, though, the interviewer will be happy with any answer that demonstrates depth of knowledge. Don't just think about technical depth. The answer "entering a valid user with an invalid password" has almost no technical depth - but mentioning the swiftness of implementation and the value of covering the basic functionality of rejecting incorrect passwords demonstrates highly valuable business awareness, and is the kind of answer I would expect from a senior QA engineer. An "interesting" answer that indicates technical depth is what I would expect from a mid-level engineer, and a list of mostly functional test cases is what I would expect from someone who is relatively junior.

Yes, I do interview QA engineers from time to time.


There are many answers for this question, but first what come's in mind, are:


Data: login: X password: Y

  • User Log in correctly using proprietary data



login: [not registered login] V password: Y

  • User can't log in with unregistered login


login: X password: [Bad password] B

  • User can't log in with proprietary login and bad password

Pre condition: System unavailable


login: X password: Y

  • User can't log in to system with proprietary login and password (servers are down, no internet connection, etc )

If I make mistake please someone correct me, but I always use something like this (and much more) and it's work well. Sorry for not formatting text but I'm in work and don't have much time ;)

  • What makes this "best"? – Joe Strazzere Aug 23 '15 at 23:12
  • Why do you think these are the best? How about getting in to the system without login? Would that be a better candidate for negative test then what you explained above? Or the form allows dictionary and brut force attacks! – IAmMilinPatel Feb 3 '16 at 12:44

You are focussing on the letter of the question over the spirit. Ask yourself, "why is this person asking me this question in an interview"? The answer is that most likely, they are not really interested in the subject matter itself, they just want to get an idea of how you work and what your thought process is.

As such, you should worry less about what the 'best' answer is and more about explaining why you come to the conclusions you're drawing. I would start by describing the questions you would ask in order to get the required context that will allow you to make a better judgement on what aspects of the login page are important. Make no assumptions here: although it's rare, there is always a chance that the actual mechanics of the login page are not really important in this case and that the visual aspect is valued the highest here. A good tester doesn't just blindly start testing, they will try to get an idea of what the client expects first. This means asking about the requirements of the login page and about the business value of it.

When you do make assumptions, verify them with the interviewer. A simple "I assume the security of the login system is the most important aspect here, would that be correct in this case?" will do the trick.


Yes, Agree with above answer, many ways to answering this question, in such I try to define a positive and Negative test cases of the Login page as below:

  • Positive Test Case

1) Verify the Correct username,Correct password - Login Successfully.

  • Negative Test Cases

1) Verify the Incorrect username,incorrect password- Can't Login

2) Verify the Incorrect username,incorrect password- Can't Login

3) Verify valid username and empty password. -Can't Login

4) Verify empty username and valid password. - Can't Login

5) Verify some password(can be a registered/unregistered)- Can't Login

6) Verify case changed username /password.- Can't Login

7) Verify registered user's login id and password -Can't Login

8) Verify registered username and password.- Can't Login

9) Verify to enter disable(Blocked) email address.- Can't Login

10) Verify to unverified Email address. - Can't Login

  • I'd like to add: Verify the input of special characters, JS-sniplets, SQL injections etc. – bish Jul 26 '15 at 5:53

To help answer this question, you just need to focus on the difference between what a positive test case and a negative test case is.

  • A positive test case confirms some expected functionality. E.g: A user with a valid username, and the corresponding password can log in successfully.

  • A negative test case tests for unexpected or invalid conditions, and confirms that the code can hold up in these circumstances. Generally, most exploration is found here.. For example, for a website:

    • Cannot log in without valid, matching credentials.
    • Is the username allowed to contain non printable characters? If not, this is invalid on the 'create user' section.
    • If the username is allowed to contain non printable characters, the code handling login can deal with them and no error is thrown.
    • Empty fields on the login screen stop the user logging in.
    • The user must be logged in to access any other area of the site.
    • The user must be logged in to call any webservices.

etc etc.


First thing you need to do is whenever they ask this question you need to tell then:

First you need to do smoke testing whenever we are writing any testcase:

  1. You need to write "test case" for login button functionality.
  2. Then username and password with different test case using positive and negative test cases.


  • Should allow to enter minimum number of characters
  • Should accept alphanumeric and special characters
  • Password should allow alphanumeric with encryption (*****)
  • Password should allow to enter minimum characters


  • Check with more than required characters (If validity is six characters and the tester gives eight characters)
  • Check with different username and different password to access the page

You can also use simple technique using Truth Table Example

  • T indicates True
  • F inducates False

Now see the below chart:

Case 1
T * T = T (means correct user name and correct password result must be login )

Case 2
T * F = F(means correct user name and invalid password result must be failed)

Case 3
F * T = F(means invalid user name and correct password result must be failed)

Case 4
F * F = F(means invalid user name and invalid password result must be failed).

here you can say Case 1 is Positive test case while remaining are negative.


First of all, ask interviewer what are the fields on the page and what are mandatory, If you dont ask him, then he will question you back- why you considered the fields mandatory then ask him, what are the possible valid values (like password should be alphanumric and not less tha 8 char)

After that start your test cases:

  1. Verify that the login screen is having option to enter username and password with submit button and option of forgot/reset password (button depends on question what interviwer asked)
  2. Verify that user is able to login with valid username and password
  3. Verify that user is not able to login with invalid/blank/not-registered username and/or password
  4. Verify that validation message gets displayed in case user leaves username or password field as blank
  5. Verify that validation message is displayed in case user exceeds the character limit of the user name and password fields
  6. Verify that there is reset button to clear the field's text
  7. Verify if there is checkbox with label "remember password" in the login page
  8. Verify that the password is in encrypted* form when entered
  9. Verify that there is limit on the total number of unsuccessful attempts
  10. For security point of view, in case of in correct credentials user is displayed the message like "incorrect username or password" instead of exact message pointing at the field that is incorrect. As message like "incorrect username" will aid hacker in bruteforcing the fields one by one
  11. Verify the timeout of the login session
  12. Verify if the password can be copy-pasted or not
  13. Verify that once logged in, clicking back button doesn't logout user but for secured sites, user should be log out.
  14. Verify if SQL Injection attacks works on login page
  15. Check log in by upper and lower cases for same User nam
  16. If User name is email and if does not have @, then error messages should be relevant.
  17. check '*' sign for mandatory fields
  18. Check UI : all the fields are placed correctly
  19. check the font, color, font size for characters

20 . test on different devies with different browser and their different version for safer side



1 Verify if a user will be able to login with a valid username and valid password. Positive

2 Verify if a user cannot login with a valid username and an invalid password. Negative

3 Verify the login page for both, when the field is blank and Submit button is clicked. Negative

4 Verify the ‘Forgot Password’ functionality. Positive

5 Verify the messages for invalid login. Positive

6 Verify the ‘Remember Me’ functionality. Positive

7 Verify if the data in password field is either visible as asterisk or bullet signs. Positive

8 Verify if a user is able to login with a new password only after he/she has changed the password. Positive

9 Verify if the login page allows to log in simultaneously with different credentials in a different browser. Positive

10 Verify if the ‘Enter’ key of the keyboard is working correctly on the login page. Positive

Other Test Cases

11 Verify the time taken to log in with a valid username and password. Performance & Positive Testing

12 Verify if the font, text color, and color coding of the Login page is as per the standard. UI Testing & Positive Testing

13 Verify if there is a ‘Cancel’ button available to erase the entered text. Usability Testing

14 Verify the login page and all its controls in different browsers Browser Compatibility & Positive Testing.


1 Verify if a user cannot enter the characters more than the specified range in each field (Username and Password). Negative

2 Verify if a user cannot enter the characters more than the specified range in each field (Username and Password). Positive

3 Verify the login page by pressing ‘Back button’ of the browser. It should not allow you to enter into the system once you log out. Negative

4 Verify the timeout functionality of the login session. Positive

5 Verify if a user should not be allowed to log in with different credentials from the same browser at the same time. Negative

6 Verify if a user should be able to login with the same credentials in different browsers at the same time. Positive

7 Verify the Login page against SQL injection attack. Negative

8 Verify the implementation of SSL certificate. Positive .


I would include tests for expired passwords.

  • While tests for expired passwords are valid test cases, the OP is asking for the "best" positive and negative test cases - what does your answer add to the existing answers? – Kate Paulk Feb 2 '16 at 13:01
  • Don't be so negative. – Sperk Feb 9 '16 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.