6

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?

3
  • I found best login test case sample here : thesoftwaretesting.com/test-cases You can download from here. Jul 24, 2015 at 5:26
  • 3
    Did you ask the interviewer what "best" meant in this context? Without that, this question cannot be answered. Aug 23, 2015 at 12:32
  • There are no best positive and negative test cases. There's only a certain context within which you want to test for some risks. E.g. some systems log login attemps and it might be really important for someone, some systems limit your number of login attemps, some don't etc. You can't really test if you don't know what you're dealing with. But I understand it's tempting for recruiters to just ask this question and then hire the one candidate who memorised the most test cases.
    – pavelsaman
    Jun 24, 2021 at 19:20

13 Answers 13

11

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.

4

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

Positive:

Data: login: X password: Y

  • User Log in correctly using proprietary data

Negative:

Data:

login: [not registered login] V password: Y

  • User can't log in with unregistered login

Data:

login: X password: [Bad password] B

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

Pre condition: System unavailable

Data:

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 ;)

2
  • What makes this "best"? Aug 23, 2015 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! Feb 3, 2016 at 12:44
2

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.

1

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

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

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.

0

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.

Positive:

  • 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

Negative:

  • 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
0

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.

0

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

0

Functional

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.

Security

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 .

0

Verify that as soon as the login page opens, by default the cursor should remain on the username textbox.

Verify that the user is able to navigate or access the different controls by pressing the ‘Tab’ key on the keyboard.

Check if the password is in masked form when typed in the password field.

Check if the password can be copy-pasted or not.

Verify that the user is able to login by entering valid credentials and clicking on the ‘Login’ button.

Verify that the user is able to login by entering valid credentials and pressing Enter key.

Check that the user is not able to login with an invalid username and password.

Verify that the validation message gets displayed in case the user leaves the username or password field as blank.

Check that the validation message is displayed in the case the user exceeds the character limit of the user name and password fields.

Verify that reset button functionality on the login page. Clicking on it should clear the textbox’s content.

Verify if there is a checkbox with the label “remember password” on the login page.

Verify that closing the browser should not log-out an authenticated user. Launching the application should lead the user to login state only.

Read complete at: test cases for login page by ArtOfTesting

0

Being a part of a software testing service, sharing additional below list of positive and negative test cases for a login page:-

Negative Testcases:

  1. Verify the login page when both the field is blank and Submit button is clicked.

  2. Verify the sign-in functionality by clicking multiple times on sign-in button.

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

  4. Verify the login page by pressing Back and Forward button of the browser. It should not allow you to enter into the system once you log out.

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

Positive Testcases:-

  1. Verify if a user will be able to login with a valid username and valid password.
  2. Verify the ‘Forgot Password’ functionality.
  3. Verify the ‘Remember Me’ functionality.
  4. Verify the validation messages for invalid login.
  5. Verify if a user is able to login with a new password once the password has changed.
  6. Verify the timeout functionality of the login session.
  7. Use enter button after typing correct username and password.
  8. Use tab to navigate from username textbox to password textbox and then to login button.
  9. Verify the validation for maximum allowed incorrect login attempt.
  10. Verify the login using deactivated user.
-1

I would include tests for expired passwords.

1
  • 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, 2016 at 13:01
-1

I came across good resource to answer your question on Test Cases

along with Login test cases you will find some other test cases for your reference. this blog covers almost most of the test case related questions which may get asked in interviews.

2
  • 1
    Welcome to the community! I recommend reviewing sqa.stackexchange.com/help/how-to-answer "Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the external resource is unreachable or goes permanently offline. Links to other websites should always be helpful, but avoid making it necessary to click on them as much as possible."
    – Lee Jensen
    Jan 29 at 16:37
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – Prome
    Jan 31 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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