Code Monkey home page Code Monkey logo

backend_test_automation_assignment_tokopedia's Introduction

REST API Test Automation Framework

TestCase-Design This Test Automation Framework is created using Java + TestNG + RestAssured + ExtentReports, which can be used across different api based applications. In this approach, the endeavor is to wrap the common requirements of API's for specific application within the wrapper class in order to test the API's without spending any extra efforts on common requirements. With this framework in place, whenever we need to automate API's, we would not need to start from scratch, and begin with developing the test cases straight away.

Pre-Requisites

  • IntelliJ or Eclipse
  • Java JDK-1.8 or higher
  • Apache Maven 3 or higher

It uses REST Assured, Cucumber, JUnit, Allure and Gradle.

Set up Install Git Install Java 11 Install Gradle Install Allure (optionally) to get fancy reports Clone this repository You can clone this repo using git console via https:

git clone from github

Running tests To run all the tests just call gradle at project's root with "clean test" command:

gradle clean test

Reporting

ExtentReport

  • The framework supports Extent Report for Reporting purpose. On execution, new directory is created under Ouput folder where all artifacts related to the execution resides. The report gives the details information on the Request & Response for each API executed.

Automation Strategy This framework needs to be scaled to cater to the entire API testing of your application

Approach Currently the framework adheres to a BDD model: Features->Scennarios->Step Defnitions->RestTestLib This approach brings a collaborative model to the API testing where the Business Analysts, Developers and testers could work in tandem in Agile to conceive the acceptance criteria leveraging Gherkin. Test automation engineer could build step defintions and rest assured methods and assertions by consulting the developers. Testsuite could be executed as Maven Verify (mvn verify).

However at present, framework needs to add the following classes/components in order to be more scalable:

An utility class with a few rest assured methods such as request spec builder, response spec builder, common assertions like validating status code, parsing the response for headers, response objects, etc Helper class (Support Code) specific to a project which returns parsed response. For example JSON path of a particular object or construcing an arraylist object for validation, etc. Environment variables need to be moved to properties (serenity.properties) Report doesn't print Rest Query which needs to be investigated Logging needs to be expanded further Future model: Features->Scennarios->Step Defnitions->RestTestLib->Custom Helper Classes

#Test Coverage Test scenarios Though every microservice is an independent entity, still it needs to be tested for integration. I'll identify the tests with the following approach:

End-to-End test testing of the data flow between various services and its different request/responses. This could achieved by creating the Features/Scenarios from Cucumber and writing step defnitions and further steps to call the API layer. Services that impact funds/monetary values (For ex., transfer between accounts, updating bank balance) Services that are called frequently APIs that could impact the business profusely if failed or unavailable Also I'll segregate the tests based on 'pre-integration' and 'integration-tests' which would give us the ability to run the new featuers during the 'pre-integration' but the 'integration-tests' for regression, etc.

Continuous Testing with the aid of integration to CI/CD will provide the team a visibility. So it's mandatory to integrate the tests in pipeline.

#Factors to consider Backgrounds and Sceanrio Outlines - In the feature files in Cucumber Gherkin, this brings the reusability to the fore Step Defintions Reusability- Reusing the step defintions this trickles down from the Backgrounds and Sceanrio Outlines in Feature files Building reusable utility/helper classes which could be API Specific, Project related and common methods for entire REST architecture Providing examples (Dataset) in Features for multiple test iterations Mocking responses where third-party APIs are required Meeting the Agile sprint testing goals through Automation Working in tandem with GUI automation where required (For example., Creating Synthetic data and Deleting it as part of the Tear down exercises using API tests) Providing feedback by leverging email plugins in CI/CD platform to keep the stakeholders posted on the test results

backend_test_automation_assignment_tokopedia's People

Contributors

leonranger avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.