Jun 16, 2018

API Automation Test

As per Top 10 API Testing Tools, API Test becomes a buzz word now because many companies nowadays require strong API performance and shifts towards APIs architecture, hence this summary post of API test.

Use Katalon

As I said in earlier post, I'm a fan of Katalon Studio which combines UI and API test in one Eclipse based user friendly IDE with valuable Recorder(record/play) feature! Only missing part is no direct support of performance test.

As shown in Create your first API test with Katalon Studio (manual style without scripting) and Katalon Web Service Test (video with a little bit scripting), Katalon supports API test in powerful user friendly way as other popular API test tools e.g. Postman, Restlet Client; By Parameterize a Web Service object and scripting, we could have all kind of APIs calls combinations.

The important point here is Katalon uses Groovy as scripting language, besides enjoy the beauty of Groovy, we have full control of the scripts flow! We could introduce any other external Java libraries into Katalon Studio to leverage all powerful features on Data-driven, assertion etc. integrating with UI/API testing. Even make up some performance test indirectly with coding around 3rd party libraries e.g. REST Assured.

Use long live JMeter

And still love JMeter if load test API after feature test is a must. JMeter is born for load test!
Pure Coding style using REST Assured

With REST Assured along come out home brew BDD style API test! Recommend tutorial.


Jun 15, 2018

Geb / Spock Gatling vs JMeter

is a browser automation solution. GEB = Selenium WebDriver + Java + Groovy + Jquery
It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modelling and the expressiveness of the Groovy language.
It can be used for scripting, scraping and general automation — or equally as a functional/web/acceptance testing solution via integration with testing frameworks such as Spock, JUnit & TestNG.
Spock (same idea as Cucumber): 
Spock is a testing and specification framework for Java and Groovy applications. 
Spock lets you write specifications that describe expected features (properties, aspects) exhibited by a system of interest.

Gatling is a highly capable load testing tool. It is designed for ease of use, maintainability and high performance.
Out of the box, Gatling comes with excellent support of the HTTP protocol that makes it a tool of choice for load testing any HTTP server. As the core engine is actually protocol agnostic, it is perfectly possible to implement support for other protocols.
Gatling simulation scripts are written in Scala.

JMETER VS GATLING TOOL: https://octoperf.com/blog/2015/06/08/jmeter-vs-gatling/

Jun 3, 2018

Selenium WebDriver Automation Best Practices (Refer to testautomationguru)

Notes while learning from testautomationguru.com (THANKS!) which need strong development skills ;) With help of Katalon, seems most best practices could be implemented :) Keep the summary to remind best practices will always help!

1. Page Objects Model, + Arquillian Framework
  1. Page Objects: Page objects is a well known design pattern, widely accepted by the automation engineers, to create separate class file for each page of the application to group all the elements as properties and their behaviors / business functionalities as methods of the class. But it might not be a great idea always, especially when the page has more / different sets of elements / complex element like a grid / calendar widget / a HTML table etc. ex http://www.testautomationguru.com/keyword-driven-framework-for-localization-testing-using-selenium-webdriver/ (Table/keyword driven + page objects model)
  2. Selenium WebDriver – Blackbox Automated Testing using Arquillian Framework 
  3. Selenium WebDriver – Advanced Page Object Pattern with Page Fragments using Arquillian Graphene (Single Responsibility Principle)


3. Design patterns in Test Automation: http://www.testautomationguru.com/category/design-pattern/

"Note: Your aim should not be to implement a certain pattern in your framework. Instead, identify a problem in the framework and then recognize the pattern which could be used to solve the problem. Do not use any design pattern where it is not really required!!"

Refer to https://sourcemaking.com/design_patterns or http://www.oodesign.com/ for design patterns.

4. WebDriver in Fluent Style (java 8 Stream)

Selenium WebDriver – How To Design Page Objects In Fluent Style

5. Test Suite Management:
(By creating a custom annotation and using TestNG’s listener, We are able to skip methods without any issues and maintains the order the test execution.)

Katalon Introduction

Katalon

Recently find free (not open source) automation tool Katalon and love it, personally believe it will be more popular in near future, recommend everyone interested in automation no matter beginner or expert to take a look!  (No pay from Katalon for voluntary :D )

See what Wikipedia says about Katalon:
  • "The software is built on top of open-source automation frameworks Selenium, Appium with a specialized IDE interface (implemented on Eclipse) for web, mobile and API testing." 
  • "The main scripting language is Groovy, Java, and JavaScript and can be executed against all modern browsers, iOS, and Android applications supported by Selenium and Appium." 
  • "Katalon Studio follows the Page Object Model pattern." 
  • "The remote execution can be triggered by CI systems via Docker container or command line interface (CLI)."
Cool, right?! One more very important point missed on Wikipedia is the record and play feature. It's normally sale point of commercial automation tool (HP UFT/QTP, IBM RFT, TestComplete etc.). As a starting point or code snippet, it is a great time saving feature.

Object recognition support multiple methods to get job done which make scripts more tolerate to AUT changes, no as good as IBM RFT's but good enough.

For Selenium 1.0 IDE lover, Katalon Automation Recorder Chrome extension is the latest replacement.

Well organised Official Katalon site has all necessary information (docs, forum etc.)

There is a free Udemy course Automate everything with Katalon Studio.