GithubHelp home page GithubHelp logo

tianshanghong / gpt4go Goto Github PK

View Code? Open in Web Editor NEW
59.0 2.0 5.0 45 KB

GPT4Go: AI-Powered Test Case Generation for Golang ๐Ÿงช

License: MIT License

Go 100.00%
golang openai test-case-generation ai-testing chatgpt chatgpt-go code-generation go-testing golang-test golang-testing

gpt4go's Introduction

๐Ÿค– GPT4Go ๐Ÿš€

GPT4Go: AI-Powered Test Case Generation for Golang ๐Ÿงช

English | ไธญๆ–‡

GPT4Go is an open-source project that auto-generates test case files for Golang using OpenAI's ChatGPT ๐ŸŒ. The project helps developers quickly create test cases for their functions, ensuring that their code is tested efficiently and comprehensively ๐Ÿงช.

๐ŸŒŸ Features

  • ๐ŸŽฏ Auto-generates test cases for Golang functions using OpenAI's ChatGPT.
  • ๐Ÿšซ Skips generating test cases for already tested functions.
  • ๐Ÿ’ก Provides suggestions for breaking down large functions for better software engineering practices.
  • ๐Ÿ“š Generates well-organized, easy-to-read test case code.

๐Ÿ›  Installation

  1. Ensure that you have Golang installed on your system ๐Ÿ’ป. If not, please follow the official installation guide.

  2. Clone the repository ๐Ÿ“ฆ:

git clone https://github.com/tianshanghong/GPT4Go.git
  1. Change into the project directory ๐Ÿ“‚:
cd GPT4Go
  1. Build the project ๐Ÿ”จ:
go build .
  1. Set the required environment variables ๐ŸŒ:
export OPENAI_API_KEY=your_openai_api_key
export GPT_MODEL=model_name  # (optional, defaults to gpt-3.5-turbo)

From the OpenAI website, you can obtain an API key for OpenAI ๐Ÿ”‘. You can also specify the model you want to use for generating test cases. The default model is gpt-3.5-turbo, which is the fastest model available ๐ŸŽ, while gpt-4 is the most accurate model ๐ŸŽฏ. You can find a list of all available models here.

๐Ÿ“š Usage

To generate test cases for a specific directory or file, run the following command:

./GPT4Go path/to/your/target/directory/or/file

This command will walk through the specified directory or file and generate test cases for all functions that do not have corresponding test cases in the _test.go file.

Please note that you will need an API key for OpenAI to use the ChatGPT functionality ๐Ÿ”. You can obtain one from OpenAI's website.

๐Ÿ‘ฅ Contributing

Contributions are welcome! Please feel free to submit pull requests ๐Ÿ“ฅ, report bugs ๐Ÿž, or suggest new features ๐Ÿ’ก through the GitHub issues page.

๐Ÿ“„ License

GPT4Go is licensed under the MIT License ๐Ÿ“ƒ.

๐Ÿ™ Acknowledgements

This project is built using OpenAI's ChatGPT, a powerful language model for generating human-like responses ๐Ÿง . You can learn more about ChatGPT and GPT-4 architecture on the OpenAI website.

gpt4go's People

Contributors

tianshanghong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gpt4go's Issues

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.