API QA Framework Integration – DevOps Way

The idea is to get a project/product level API QA framework creation and to empower the implementation through DevOps way of doing.

Including:

  • Jenkins latest version with pipeline plugin
  • Assertible
  • Apickli
  • Slack
  1. Get Jenkins up and running in local
    1. https://jenkins.io/download/
    2. Once Jenkins installed successfully it will be running in the URL http://localhost:8080/login?from=%2F
    3. Navigate to Jenkins -> Plugin Manager and install ‘Build Pipeline Plugin’
  2. Assertible, set up steps as suggested in the referred blog, with this unit testing set up will be ready for the API https://devonblog.com/software-development/assertible/ In this case: The target URL in the set up for unit testing is: https://snatarajan-eval-test.apigee.net/enecopingproxy with basic auth as username – admin and password – admin

  1. Download and install Slack(Windows/Mac/Ubuntu)
    https://slack.com/downloads/windows
    Create an organisation in slack registered with an email account
  1. Apickli – A NodeJS based API Integration testing suite built on cucumber JS framework
    1. Check out Apickli from the GitHub repository : https://github.com/apickli/apickli or install NPM https://www.npmjs.com/package/apickli
    2. The structure in local should look like below :
    3. Configurations required for apickli to execute :Each integration test has to be configured as feature in apickli, in this case I created a new feature called ‘myapi-test.feature’, and it verifies a successful invocation of the API endpoint with suffix /enecopingproxy and validate the response code as ‘200’File content of ‘myapi-test.feature’Feature:
      Httpbin.org exposes various resources for HTTP request testing
      As Httpbin client I want to verify that all API resources are working as they should
      Scenario: Setting headers in GET request
      Given I set User-Agent header to apickli
      When I GET /enecopingproxy?username=admin&password=admin
      Then response code should be 200
      As per node js, the base configuration of any NPM package is package.json and for apickli the configurations as below
      File content of ‘package.json’

      Initialization of the integration test suite has to be triggered from ‘init.js’ and in this file the host of the API has to be configured.File content of init.js:

      The apickli configuration we have made till now will invoke the endpoint ‘https://snatarajan-eval-test.apigee.net/enecopingproxy’Execute command:

Now that all the component level configurations are completed for the Devops integration of the QA framework.

  1. Jenkins configurations and job execution
    1. Unit Testing Job
      This job is to perform unit testing of the API end point by invoking the Assertible unit test suiteIn here, I created a batch file called ‘openurl.bat’ to invoke the assertible unit testing URL.
      Content : START iexplore.exe https://assertible.com/apis/f0835f22-d6fa-490e-8ba9-096862bb2275/run?api_token=sQgKXBOLBVtmUXwtIn the similar way you can invoke a CURL command if you using MAC or Linux OSIn the POST-BUILD actions, invoke the Integration Testing Job so the next course of integration testing methods will be executed.
    2. Integration Testing JobAll the set of configurations done for the apickli is ready to be invoked now.The npm run command has to be invoked as a Build – ’Execute windows batch command’
    3. Pipeline view creation
      Execute the Unit testing job by clicking play button:
      Review pipeline for the Job status:
      Verify the jobs console:

Feel free to refer to the full-fledged demo starting from git integration through to deployment and Integration testing by accessing the link – https://www.youtube.com/watch?v=7akulsVIy3M&feature=youtu.be

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*