Coder Social home page Coder Social logo

api-testing's Introduction

API-Testing

This is a sample/tutorial API showing basics steps in creating API and its testing. Micro web framework written in python called Flask is used

Getting Started

hese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Type of testing performed

Though there are many frameworks for testing like nose, doctest or unittest2 and others but unittest is the one used in this Flask Application.

Reasons for using unittest

It is the built=in module for implementing unit tests in python and is easy to use and powerful at the same time. See below for a basic structure:

import unittest 

class testClass(unittest.TestCase): 

  # First method to be executed
  @classmethod
  def setUpClass(cls):
       pass 

  # Last method to be executed
  @classmethod
  def tearDownClass(cls):
       pass 

  # initialization logic
  # code that is executed before each test
  def setUp(self):
    pass 

  # clean up logic
  # code that is executed after each test
  def tearDown(self):
    pass 

  # test method
  def test_equality(self):
    self.assertEqual(1, 1) 

# runs the unit tests in the module
if __name__ == '__main__':
  unittest.main()

Installation

Although the project doesn't require virtualenv but I would recommend doing so.

  • First fork the project and clone it through cmd:

    git clone https://github.com/<your username>/API-Testing.git

  • If you wants to use virtualenv, then follow these steps. Otherwise jump to step 5.

    pip install virtualenv

  • Then change directory and get to the project folder, then type:

    virtualenv venv

  • Activate the enviroment

    venv/Scripts/activate

  • Install the requirements

    pip install -r rquirements.txt

  • All set, run the application

    python application.py

Instructions

There are some python libraries that is to be imported before giving the application a run. List of the libraries required is as follows

Name Version
click 6.7
coverage 4.5.1
Flask 1.0.2
itsdangerous 0.24
Jinja2 2.10
MarkupSafe 1.0
psycopg2 2.7.4

api-testing's People

Watchers

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