GithubHelp home page GithubHelp logo

dantivar / api-testing-starters Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.35 MB

Repository to showcase progress on API testing and make the knowledge available for others to use

Dockerfile 3.02% JavaScript 96.98%

api-testing-starters's Introduction

API testing for starters

The aim of this repository is to make personal progress on API testing and make the knowledge obtained available for others to use.

Commit structure

For commit structure Convencional Commits specification should be followed. Said structure is as follows:

<type>[optional scope]: <description>
[optional body]
[optional footer(s)]

For more information please visit the link above.

Getting Started

Requirements

To succesfully follow the steps listed in this repository the following requirements must be meet:

  • Docker version 17.05 or above.
  • GoLang version 1.13 or above.
  • Node.js version 14.16.0 or above.
  • Access to a Bash console.

Base Project

As the purpose of this repository is not development but testing, the project in which the work is performed is called Go RESTful API Starter Kit (Boilerplate). It can be installed in UNIX systems following the given instructions in the project's documentation. Nonetheless, for Windows system a different path is recommended.

Windows Installation

For Windows system it is still recommended to have a bash console that can make use of tools such as make and chmod. First head to the app folder, there you'll find a docker image called server, a Dockerfile that will help you build the docker image for the database, a init.sql script that will create and populate some data and a testing.yml file which will contain the configuration for the testing local environment.

The first step to take is to build and run the docker image for the database. To do that, and from the app folder, you'll need to run the following commands:

# Build the docker image of the database
docker build -t psql-database .

# Run the docker image on port 5432 in detached mode
docker run -d -p 5432:5432 psql-database

With that the database should be up and running with some test data in it. Now, to run the server you'll need to make the server file executable, to do that run the following command:

chmod +x server

An then you'll just need to run:

./server -config="./testing.yml"

Now, go to your browser and access localhost:8080/healthcheck and you should see something like OK v1.0.0

Run Tests

First of all, the tests are located in the test folder and are separated in files given its endpoint. To install the packages needed, in the root folder you just need to run:

npm install

This will install Mocha, the testing framework; Supertest which is used to perform HTTP requests; and Chai which is used for assertions.

With all the dependencies set up, just run:

npm test

api-testing-starters's People

Contributors

dantivar 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.