Automating REST API Postman Test Cases Using LLM

S Deepika Sri,Mohammed Aadil S,Sanjjushri Varshini R,Raja CSP Raman,Gopinath Rajagopal,S Taranath Chan
2024-04-16
Abstract:In the contemporary landscape of technological advancements, the automation of manual processes is crucial, compelling the demand for huge datasets to effectively train and test machines. This research paper is dedicated to the exploration and implementation of an automated approach to generate test cases specifically using Large Language Models. The methodology integrates the use of Open AI to enhance the efficiency and effectiveness of test case generation for training and evaluating Large Language Models. This formalized approach with LLMs simplifies the testing process, making it more efficient and comprehensive. Leveraging natural language understanding, LLMs can intelligently formulate test cases that cover a broad range of REST API properties, ensuring comprehensive testing. The model that is developed during the research is trained using manually collected postman test cases or instances for various Rest APIs. LLMs enhance the creation of Postman test cases by automating the generation of varied and intricate test scenarios. Postman test cases offer streamlined automation, collaboration, and dynamic data handling, providing a user-friendly and efficient approach to API testing compared to traditional test cases. Thus, the model developed not only conforms to current technological standards but also holds the promise of evolving into an idea of substantial importance in future technological advancements.
Software Engineering,Machine Learning
What problem does this paper attempt to address?
The paper aims to address the issue of automated test case generation, with a particular focus on testing REST APIs. Researchers utilize Large Language Models (LLMs) to achieve this goal, integrating natural language understanding capabilities to intelligently formulate test cases that cover a wide range of REST API attributes, ensuring comprehensive test coverage. The method proposed in the paper includes the following key steps: 1. **Data Collection and Preprocessing**: Collect relevant data from multiple sources, such as databases, APIs, or files, and preprocess this data, including tokenization, normalization, etc., to fit model training. 2. **Model Training**: Train the large language model using the preprocessed data, iteratively optimize model parameters, minimize the loss function, and enable the model to better understand and generate human-like text. 3. **Model Storage and Loading**: After training is complete, store the model in a specific format file for subsequent use; during the testing phase, load the trained model into memory, ready to perform inference tasks. 4. **Model Inference and Output Prediction**: Perform inference tasks on new input data, generate output predictions, and verify the model's accuracy and adaptability. The research team used Postman to store and test API endpoints, as well as Flask as the API framework to serve the machine learning model. In addition, they utilized OpenAI's language models, such as GPT-3, implementing them through deep learning techniques. The results of the paper indicate that the method is effective and inclusive, capable of covering a wide range of API features, easing the burden on developers and testers, while conforming to current technical standards. Future research directions may include exploring different pre-trained models and transformers, as well as developing automated workflows to further optimize the testing process, especially for generating test cases for security vulnerabilities. In summary, this solution provides a solid foundation for the automation of REST API testing and demonstrates the potential of LLMs in the field of software testing.