Building a Test Automation Framework

automated-testing-best-practices-agile

Spent a wet weekend indoors and decided to spin up a testing framework.  Here is my top 11.

What’s in it?

Java 8 Maven Spring Application.   + Cucumber + Selenium + Restful API Test Automation Framework + Postgres + Spring JPA.   This setup included :

  • Restful Api call and testing using RestTemplates and a Pojo for modelling the Json.
  • BDD with Cucumber for Feature
  • Webdriver   
  • Docker
  • Postgres Db   
  • Spring JPA   
  • Swagger Api Documentation
  • Rest Assured   
  • Page Object Modelling   
  • Saucelabs integration
  • Tomcat – Standard with Spring

What else should I add in here?

BDD: Cucumber and Java

cukesnadjavba.JPG

Here is another sample test app that uses Cucumber as well as Rest Assured to test a rest call that is being mocked.

All this being driven from the cucumber feature file. In this example, we use rest templates to make a call and validate it JUnit. We also use a 1-liner with rest-assured to do the same test.

The word of the day: DIP

edamame-dip-103044760_horiz

Ok, its not actually a word but an acronym.

In “The Dependency Inversion Principle” (or DIP), the author states the three defining factors of “bad code”:

  • It is hard to change because every change affects too many other parts of the system (Rigidity)
  • When you make a change, unexpected parts of the system break (Fragility)
  • It is hard to reuse in another application because it cannot be disentangled from the current application(Immobility)