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)

Lessons Learned: Jenkins Server Management

jenkinscia

Many a times in test automation we rarely talk about the importance of goodie good Jenkins Server management.

I tell ya, I spent a week putting out fires! Im a little weird so I found it exhilarating :$ but it caused a lot of jobs not to be run, therefore proving lesser confidence in tests and applications <– terrible!

Here are some lessons learned :

  1. Expire and Clean up old builds – yes, check that box!
  2. Dont schedule jobs with unapproved scripts.
  3. Parallel runs … always parallel runs.
  4. Create a uniformed approach to building jobs.
  5. Create policies to guide and govern the above.
  6. Set  reminds to go back and clean out logs, files, builds etc.
  7. Always(Ok most of the time) run Jenkins in a Master/Salve config

Share some of your ideas below for me to learn off!