Want to Automate your Browser for UI Testing? Selenium is the way to go!
Use Cases and Deployment Scope
I use Selenium for automating browsers so I can test the UI after development. I basically write test cases covering the UI of the application I work on (Our organization requires developers to write unit tests). With the help of Selenium, I can run automated tests that run on a headless browser and monitor the backend responses as well. Whenever an issue occurs, it takes a screenshot (code written in that way). The main use of writing such test cases is that when we integrate more changes to the application, we can run the unit tests written using Selenium to make sure no part of the application breaks! This is how Selenium saves time in integration testing.
Pros
- Automating a Browser (be it headless or not).
- Wait for elements to load.
- Inject Custom JS to the automated browser.
Cons
- Selenium is a very powerful tool but when working with Java, the code needed is too big.
- It is a little slow performance wise.
Likelihood to Recommend
When you have to test the UI and how it behaves when certain actions are performed, you need something that can automate the browsers. This is where Selenium comes to the rescue. If you have to test APIs and not the frontend (UI), I would recommend going with other libraries that support HTTP Requests. Selenium is good only when you have no choice but to run the steps on a browser.
