Virtual Expo 2024

API Tester

Envision
CompSoc

       

TITLE : API Tester

TEAM MEMBERS:

MENTORS:

  1. AAHIL RAFIQ
  2. ROHAN CHANDRA R

MENTEES:

  1. ANSHUMAN DHAVE
  2. HS JAYANTH
  3. NISHANTH
  4. RAGHAV YATGIRI
  5. RONIN
  6. SAHIL
  7. SATYA KRISHNA

AIM

We aim to build an API (Application Programming Interface) Tester project can serve a variety of aims or objectives like Validation of API responses, error handling, performance testing and security testing. An API Tester project is a strategic tool in software development that not only ensures the quality and reliability of APIs but also supports various aspects of development from security to compliance and performance.

INTRODUCTION

In the rapidly evolving landscape of software development, Application Programming Interfaces (APIs) have emerged as critical components, facilitating seamless interactions between different software applications and platforms. As APIs become increasingly integral to business operations and customer interactions, ensuring their reliability, performance, and security is paramount.

This necessitates a robust framework for API testing, which is where our project, an API testing tool inspired by the popular Postman platform, comes into play. This API Tester is to has set a high standard in API testing, offering a comprehensive suite of features that support the development, testing, and maintenance of APIs. It provides an intuitive interface for sending requests to APIs, simulating how they will perform in the real world, and reviewing responses. Beyond individual request dispatching, API Tester supports automated testing and detailed monitoring, making it an invaluable tool for developers and quality assurance teams alike.

By building this project, we also gain knowledge of various software technologies and their application in real world projects. This knowledge can empower teams to have greater control over their testing environment and processes, optimizing them as necessary without relying on third-party tools' limitations or licensing constraints.

OBJECTIVES

The primary objective of this project is to develop an API testing tool that:

  • Ensures comprehensive testing of API endpoints for functionality, reliability, performance, and security.
  • Provides a user-friendly interface that allows both technical and non-technical users to create, manage, and execute API tests.
  • Allows customization to adapt to specific testing needs and integration into various software development environments.

By undertaking this project, we aim to empower developers and organizations with a versatile tool that accelerates API development and ensures robustness, thereby contributing to higher software quality and improved user experiences. This API testing tool is envisioned as a foundational step towards more reliable and efficient software integration across diverse platforms and technologies.

TECHNOLOGIES USED

Frontend

  • html , css and js (these files are inside public folder)
  • axios to make http requests
  • Bootstrap Components

Backend

  • expressjs with nodejs
  • axios to make http requests

 

LITERATURE SURVEY

1)HTML / CSS / Bootstrap

As a frontend is required for good UI/UX experience,  we went through various resources to learn HTML, CSS.

Most helpful ones are:

  • https://www.w3schools.com/html/
  • https://www.w3schools.com/css/
  • MDN Web docs

2)Javascript:

JavaScript is a powerful, versatile programming language that has become one of the cornerstones of web development. Initially created to make web pages interactive, JavaScript has evolved significantly since its introduction in 1995 by Brendan Eich

JavaScript started as a simple scripting language aimed at non-professional programmers to assemble components and automate interactions on web pages. Over the years, it has grown to support complex functionalities, becoming an essential tool for front-end, back-end, and even mobile app development thanks to environments like Node.js and frameworks like React Native.

The core features that make JavaScript particularly appealing include:

  • Interactivity: JavaScript enables developers to create interactive web pages that respond to user inputs without needing to reload the page. This is achieved through manipulating the Document Object Model (DOM) and responding to user events like clicks, hovers, and keyboard inputs.
  • Asynchronous Processing: With features like AJAX (Asynchronous JavaScript and XML) and the Fetch API, JavaScript can handle tasks like data fetching in the background, improving the user experience by making web applications faster and more responsive.
  • Flexibility: JavaScript works across all major browsers and can be integrated with other languages and technologies, making it incredibly flexible for web development.
  • Event-Driven Programming: JavaScript supports an event-driven programming style that allows actions to be controlled by events like user inputs or messages from other programs.

 

3)NodeJS / Express JS

Node.js: Revolutionizing Server-Side JavaScript

Node.js is an open-source, cross-platform runtime environment for executing JavaScript code outside of a browser. Introduced in 2009 by Ryan Dahl, Node.js was developed to address the need for a more efficient way to build scalable network applications. At its core, Node.js uses the V8 JavaScript engine (the same runtime engine that powers Google Chrome) to compile JavaScript into native machine code.

Key Features of Node.js:

Asynchronous and Event-Driven: All APIs of the Node.js library are asynchronous, that is, non-blocking. It essentially means that Node.js-based servers never wait for an API to return data. The server moves to the next API after calling it, and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call.

Single-Threaded but Highly Scalable: Node.js uses a single-threaded model with event looping. This event mechanism helps the server to respond in a non-blocking way and makes the server highly scalable as opposed to traditional servers which create limited threads to handle requests.

Cross-Platform: Node.js can run on various platforms (Windows, Linux, Unix, Mac OS X, etc.).

Express.js: The Standard Server Framework for Node.js

Express.js, or simply Express, builds on top of Node.js as a web application framework that provides robust features for mobile and web applications. It was created by TJ Holowaychuk in 2010 and is designed to facilitate the rapid development of web applications by offering a slew of straightforward and flexible APIs.

Key Features of Express.js:

Simplicity, Flexibility, and Scalability: Express simplifies the process of building server-side applications with Node.js. It provides a slight layer of fundamental web application features, without obscuring Node.js features.

Middleware: Express uses a series of middleware functions to handle requests. These functions can execute any code, make changes to the request and response objects, end the request-response cycle, and call the next middleware function in the stack.

Routing: Express provides a very powerful routing API that allows developers to map URLs to server-side functions. This is crucial for creating RESTful web services where you can perform different actions based on HTTP method and URL.

Speed: Built on the asynchronous, non-blocking nature of Node.js, Express can handle many requests simultaneously, making it a perfect choice for high traffic applications like dynamic websites and API services.

IMPLEMENTATION

Understanding APIs

Before diving into building our API Tester, let's first understand what an API is. API stands for Application Programming Interface. In simple terms, it's a set of rules that allows different software applications to communicate with each other. APIs are commonly used to retrieve data from a web server or to send data to a server.

What is an API Tester?

An API Tester is a tool that helps developers interact with APIs easily. It provides a user-friendly interface for sending requests to APIs and viewing the responses. Our API Tester will be a web-based application, accessible through a web browser. Users will input the API endpoint, select the HTTP method (such as GET, POST, PUT, DELETE), add parameters and headers if necessary, and then send the request.

Building Our API Tester

Frontend

Our frontend will consist of a single HTML file along with some CSS and JavaScript. The HTML file will contain the user interface elements such as input fields for the API endpoint, method, parameters, and headers, as well as a button to send the request. The CSS will be used for styling the UI, making it visually appealing. The JavaScript will handle user interactions, such as capturing the input values and sending the request to our backend server.

Backend

We'll use Express.js, a popular web application framework for Node.js, to build our backend server. The backend will receive the request from the frontend, make the corresponding request to the API on behalf of the user, and then send the response back to the frontend. We'll use the fetch API or libraries like Axios to make HTTP requests from our backend.

How It Works

  1. User Input: The user enters the API endpoint, selects the HTTP method, and optionally adds parameters and headers.
  2. Frontend Request: When the user clicks the "Send" button, the frontend sends a POST request to our backend server.
  3. Backend Processing: Our backend server receives the request, extracts the necessary information (such as the API endpoint, method, parameters, and headers), and makes a request to the API.
  4. API Response: The backend receives the response from the API and sends it back to the frontend.
  5. Display Response: The frontend displays the API response to the user.

FINAL PROJECT DISPLAY

 OUR frontend part:

OUR DIRECTORY STRUCTURE:

Future Scope of the API Tester Project:

  1. Advanced Automation Capabilities
  2. Expanded Test Coverage
  3. Cloud and distributed Testing
  4. Integration with CI/CD pipelines
  5. User experience and Accessibility Improvements

Conclusion

The future scope of our API Tester project aims not only to keep pace with technological advancements but also to anticipate future trends and challenges in API development. By continuously evolving, the project can maintain its relevance and utility, providing significant value to its users and staying ahead of the competition in the tools market.

Github Link for Source code

References

  • MDN docs
  • W3 schools
  • Bootstrap
  • Node JS : https://nodejs.org/en
  • Express JS: https://expressjs.com/

Acknowledgment

As executive members of IEEE NITK, we are incredibly grateful for the opportunity to learn and work on this project under the prestigious name of the IEEE NITK Student Chapter.

Google Meet Link: https://meet.google.com/pxw-qqmx-nim

 

METADATA

Report prepared on May 2, 2024, 10:20 p.m. by:

  • Regulagadda Rohan Chandra [CompSoc]
  • Aahil Rafiq [CompSoc]

Report reviewed and approved by Aditya Pandia [CompSoc] on May 9, 2024, 10:49 p.m..

Check out more projects!