Skip to content

A lightweight Next.js application that enables users to generate REST Assured code by providing the required parameters.

License

Notifications You must be signed in to change notification settings

osandadeshan/rest-assured-code-generator

Repository files navigation

REST Assured Code Generator

REST Assured Code Generator GitHub deployments GitHub last commit GitHub commit activity GitHub top language GitHub contributors GitHub License

Overview

The REST Assured Code Generator is a simple Next.js application designed to streamline the process of generating REST Assured test code. By inputting the necessary parameters, users can quickly obtain a code snippet that can be used to test APIs. This single-page application focuses on simplicity and efficiency, making it easier for users to create test cases without unnecessary complexity.

REST Assured Code Generator GIF

Features

  • Input Fields:

    • Base URL: Text box for entering the base URL of the API.
    • API Endpoint: Text box for entering the specific API endpoint.
    • Query Parameters: Two text boxes (key and value) with a "+" button to add more parameters as needed.
    • Path Parameters: Text box for entering path parameters with a "+" button to add additional parameters.
    • Headers: Similar to query parameters, allows for key-value pairs with the option to add more.
    • Request Body: A dropdown to choose between JSON and form-data formats, along with an appropriate text area for input.
    • Expected Status Code: A searchable dropdown listing all possible HTTP status codes.
  • User Interface:

    • The left side of the application contains all input fields for user convenience.
    • The right side displays the generated REST Assured code snippet along with a "Copy Code" button.
  • Code Generation:

    • On clicking the "Generate Code" button, the application compiles all the input data into a well-structured REST Assured test code.

    UI

Getting Started

Prerequisites

  • Node.js (version 14 or later)
  • npm (version 5.6 or later)

Installation

  1. Clone the repository:

    git clone https://github.com/osandadeshan/rest-assured-code-generator.git
    cd rest-assured-code-generator
  2. Install the dependencies:

npm install
  1. Start the development server:
npm run dev
  1. Open your web browser and navigate to http://localhost:3000 to view the application.

Usage

  1. Enter the Base URL and API Endpoint in the provided text boxes.
  2. Add Query Parameters and Path Parameters using the "+" buttons.
  3. Enter any necessary Headers.
  4. Select the appropriate Request Body Type (JSON or form-data) and provide the body content if required.
  5. Enter the Expected Status Code.
  6. Click the Generate Code button to create the REST Assured test code.
  7. Use the Copy Code button to easily copy the generated code to your clipboard for further use.

Technologies Used

  • Next.js
  • React
  • TypeScript
  • CSS (for styling)

Deployment

The application is deployed on Vercel. You can try it out here.

License

This project is licensed under the MIT License. You are free to use, modify, and distribute this software under the terms of the license.

MIT License MIT License

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

Acknowledgements

  • Inspired by the need for efficient API testing and automation.
  • Thanks to the open-source community for their valuable tools and resources.