Code Monkey home page Code Monkey logo

api-tests's Introduction

Build Status

DHIS2 API Testing

Repository for DHIS2 API Testing.

Technology stack

  • Cucumber: Framework for test automation using Behaviour Driven Development
  • Axios: Promise based HTTP client for Node.js used to execute HTTP requests to DHIS2 REST API
  • Chaijs: BDD/TDD assertion library
  • Cucumber-html-report: Library used to generate HTML report after all test cases are executed
  • Docker: Used to bootstrap a clean environment which executes all case tests using an isolated web application for the REST API and a custom database

How to add new tests

  1. Create a Gherkin file inside features folder. A new folder should be created for each individual module (e.g. /features/organisation_units for organisation unit related test cases)
  2. Create a JavaScript file inside step_definitions folder to execute the steps defined on the previous point. Check Cucumber.js documentation for more details

Tests Execution

Set the environment variable DHIS2_GENERATE_HTML_REPORT to true if you want an html report to be generated. Default value is 'false':

$ export DHIS2_GENERATE_HTML_REPORT=true

Define the environment variable DHIS2_FEATURE to only execute a specific feature file. If not defined it will execute all feature files:

$ export DHIS2_FEATURE=features/users/users.feature

Set the environment DHIS2_LOG_MODE to debug to log debug messages. If not defined debug messages will not be printed:

$ export DHIS2_LOG_MODE=debug

Set the environment DHIS2_API_VERSION to desired api version to be tested. Default value is 27:

$ export DHIS2_API_VERSION=27

Start tests execution:

$ ./run.sh # or run.bat for Windows

Local Execution

A local execution should not be used since it will not guarantee an expected state of DHIS2 Web Application for the tests. However, you might use it following these directions:

Make sure you have the required NPM dependencies installed:

$ npm install

Set the environment DHIS2_BASE_URL to desired DHIS2 Web endpoint. If not defined it will use default endpoint as https://play.dhis2.org/demo:

$ export DHIS2_BASE_URL=https://play.dhis2.org/demo

Run tests:

$ npm test

All environment variables mentioned before might be used.

api-tests's People

Contributors

samaxes avatar jason-p-pickering avatar joaoantunes87 avatar pgracio avatar

Watchers

 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.