Search This Blog

Thursday, October 17, 2019

Framework Evaluation & Selection

Framework Evaluation Criteria

  1. Support automation integration testing for UI (real/headless browser/device), API,  performance in cross platforms.

    • For the integration test, we don’t test the front-end or back-end individually. We need to verify the data with the integration between system, front-end & back-end. So the framework needs to be able to support all testing type and especially crossing browser, device & system.
  2. Support CI integration with parallel execution.

    • The testing framework needs to be able to integrate with our current CI/CD. Parallel execution will help reduce the build time, so we will be able to deploy quickly and have faster turnaround times for bugs and features.
  3. Supports the concept of executable documentation for BDD (behavior-driven development)& DDT (data-driven testing) in modularization, maintainable and understandable test suites.

    • BDD will help the test case & test suite easy to maintaining and understanding. It also helps communication between business and development is extremely focused as a result of common language.
    • One of the most important concepts for effective test automation is modularization, it will help to create a sequence of test case only one and reuse as often as required in test script without rewriting the test all the time.

BDD Testing Framework Selection


GaugeCucumber
LanguageMarkdownGherkin
IDE & plugin supportYesYes
Easy to integrate with CI/CDYesYes
Easy to use, quick to learnNoNo
Reusable, easy to maintainYesYes
Parallel executionBuilt-in3rd party plugin
Customize reportingYesYes
PriceOpen source & free Open source & free 

Winner - Gauge:

  • An open source lightweight cross-platform test automation tool with the ability to author test cases in the business language and have built-in parallel execution feature.
  • Support BDD (Behavior-Driven Development) & CI(Continuous Integration) & report customization.

API Testing Framework Selection


REST AssuredPostman
Support BDDYes3rd third party
Support DDTYesLimit
Easy to integrate with CI/CDYesYes
Easy to use, quick to learnNoYes
Reusable, easy to maintainYesNo
Customize reportingCan be used with any customized/open source reporting tool.No
PriceOpen source & free 8-21$ per user/month for professional collaboration  & advanced features
  

Winner - REST Assured:

  • An open source Java-based Domain-Specific Language (DSL) that allows writing powerful, readable, and maintainable automated tests for RESTful APIs. 
  • Support testing and validating REST services in BDD (Behavior-Driven Development) / Gherkin format.

API Performance Testing Framework  Selection


Apache JMeterLoadrunner
Support DDTYesYes
Easy to integrate with CI/CDYesYes
Easy to use, quick to learnYesNo
Cross-platformYesWindows, Linux
Reusable, easy to maintainYesNo
Customize reportingYesYes
PriceOpen source & free Free for first 50 virtual User

Winner - Apache JMeter : 

  • Open source performance test runner & management framework may be used to test performance both on static and dynamic resources.
  • Support load test functional behavior and measure performance. It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

Test Runner & Test Suite Management Framework Selection


TestNGJUnit
Support DDTYesYes
Easy to integrate with CI/CDYesYes
Easy to use, quick to learnNoNo
Reusable, easy to maintainYesYes
Parallel executionYesYes
PriceOpen source & free Open source & free 
Annotation supportYesLimit
Suite TestYesYes
Ignore TestYesYes
Exception TestYesYes
TimeoutYesYes
Parameterized TestYesYes
Dependency TestYesNo
Support executing before & after all tests in the suiteYesNo
Support executing  before & after a test runsYesNo
Support executing  before the first & last test method
is invoked that belongs to any of these groups is invoked
YesNo

Winner - TestNG :

  • Open source test runner framework which helps to run your tests in arbitrarily big thread pools with various policies available and flexible test configuration.
  • Support DDT(Data-driven testing) & Test suite management.

Build Tool & Dependency ManagementFramework Selection


Apache MavenGrandle
Easy to integrate with CI/CDYesYes
Easy to use, quick to learnYesNo
Build Script LanguageXMLGroovy
Reusable, easy to maintainYesYes
Dependency ManagementYesYes
Dependency ScopesBuilt-inCustom
IDE & plugin supportManyA little
PriceOpen source & free Open source & free 

Winner - Apache Maven 

  • The leading open source dependency management and build tool. It standardizes the software build process by articulating a project’s constitution.
  • Software project management and comprehension tool in the concept of a project object model (POM), Maven can manage a project's build, reporting, and documentation from a central piece of information.

Sunday, September 15, 2019

Mocking a RESTful Microservice in MounteBank

What is MounteBank?

Mountebank is the first open source tool to provide cross-platform, multi-protocol test doubles over the wire. Simply point your application under test to mountebank instead of the real dependency, and test like you would with traditional stubs and mocks.
Basically it provides a server that can be configured using a DSL to simulate requests and responses over variety of protocols (http, https, tcp and smtp).

How it works?

MounteBank

Installation

There are various ways to install MounteBank on different platforms. We recommend to use via npm.
  1. Install npm
  2. Install MounteBank globally
$ npm mountebanck -g

Start MounteBank

$ mb –allowCORS –allowInjection –mock
By default it starts on the port 2525.
Now let’s learn some basic terminologies used by MounteBank DSL.
  • Response - Defines status code, headers and body
  • Predicate - Conditions to check request to match some criteria based on which response will be returned
  • Stub - Also called Imposter is a Collection of predicates and responses for simulating an API
The DSL is very rich and we cannot cover everything here. For more details visit the API contract.
Now let us mock Get All Posts and Get a Specific Post API.
Use this JSON and send it to MounteBank Server already running on your local machine.

MounteBank Server
Create an Impostor for Get All Posts

It should create an impostor successfully and return same JSON as you sent in request.
Now go and hit http://localhost:9999/posts in REST Client or Browser and you should receive JSON having two posts data.

Response from GET /posts
Response from GET /posts

Response from POST /posts
Response from POST /posts

Now it’s your turn. Create impostors for rest of the RESTful APIs and get hands on it.

My Profile

My photo
can be reached at 09916017317