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?
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 ;)
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:
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:
You can also use simple technique using Truth Table Example
Now see the below chart:
T * T = T (means correct user name and correct password result must be login )
T * F = F(means correct user name and invalid password result must be failed)
F * T = F(means invalid user name and correct password result must be failed)
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.
I would include tests for expired passwords.
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
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 .