Testing Single Page Applications (SPA) with Selenium

Hi All, I am looking to automate SPA with Selenium WebDriver using Java-based framework like TestNG (or JUnit) or BDD frameworks. What are some of the things that I should take care of from an implementation point of view. Which is the ideal framework (in Java) for realizing SPA?

Thanks.

1 Like

Hi Steven Bister, SPA is not the only factor to consider for automation framework. there could be more factor:-

  • other then automation engineer who else will be using that.
  • does the manual guys gonna use it.
  • do you have different test case management tool or not.

most of people use TestNg/junit with page object model.

junit/TestNg pros:-

  • as it is SPA to single test can be use to automate full page.
  • they are fast in execution as few overhead are removed.

Junit/TestNg cons

  • Manul guys colouration is hard
  • fixing became tedious some time.
  • maintainability is not that good.
  • canā€™t run lower then test unit.

Cucumber Pros:-

  • Manual guys can use steps and contribute.
  • if organisation is small you can use feature files as test cases.
  • as it is feature wise so you can run partial with not sticks to pages.
  • good in maintainability.

Cucumber Cons:-

  • extra layer
  • sometime when people are not following best practices it could be just an overhead in a wrong way.
  • BDD is useful when you are following ā€œthe cucumber bookā€. manual Guys can use that. Test case are beneficial. otherwise no benefit of using that.

if there are too low amount of test cases than use TestNG with POM structure.

if that will expend in future and you need full framework then use TestNG_Cucucmber_java combo.

TestNG give scenario level parallel so it is preferred comparing to Junit.

2 Likes