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?
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityOne 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?
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:
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 ;)
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:
1) Verify the Correct username,Correct password - Login Successfully.
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
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:
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:
Positive:
Negative:
You can also use simple technique using Truth Table Example
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:
20 . test on different devies with different browser and their different version for safer side
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 .
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
Being a part of a software testing service, sharing additional below list of positive and negative test cases for a login page:-
Negative Testcases:
Verify the login page when both the field is blank and Submit button is clicked.
Verify the sign-in functionality by clicking multiple times on sign-in button.
Verify if a user cannot enter the characters more than the specified range in each field (Username and Password).
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.
Verify if a user should not be allowed to log in with different credentials from the same browser at the same time.
Positive Testcases:-
I would include tests for expired passwords.