I need to test a login form using selenium. The step checks by inputting various combination of the username and password. For eg. . I have used TestNG to perform the test. Is there any other approach that can be used or this is will be fine. Can POM be used for the purpose?
I suggest you to use Cucumber framework with Selenium so that you can define Scenario Outlines including different username and password variations. Here is an example:
Scenario Outline: Sample Scenario: New user onboarding
Given user navigates to blog page
When user clicks "New"
Then user should proceed "Onboarding" screen
Then user enters "<SampleUserName>" to "Mail" area
And user enters "<SamplePw>" to "Mail" area
And user clicks "Submit"
Examples:
| SampleInValidMail | SamplePw |
| @example.com | pw1 |
| #@%^%#$@#$@#.com | pw2 |
| \Joe Smith <[email protected]> | pw3 |
| email.example.com | pw4 |