Giter VIP home page Giter VIP logo

testaurant's Introduction

Testaurant ๐Ÿง‘โ€๐Ÿณ

Testing made deliciously easy

Testaurant is a command line tool for generating unit tests using GPT-3 or ChatGPT. It allows you to quickly and easily generate unit tests for your code without having to write them manually.

Installation

To install Testaurant, run the following command:

yarn add global testaurant

Usage

Basic usage

To generate tests for a file, run the following command:

testaurant auto-test --input-file /path/to/file.js --output-file /path/to/output.js --api-key YOUR_API_KEY --model MODEL_NAME

Using a configuration file

You can also use a configuration file to specify default options for Testaurant. To use a configuration file, create a YAML file with the following structure:

Replace YOUR_API_KEY with your OpenAI API key and MODEL_NAME with the name of the GPT-3 model you want to use.

.js:
  techs:
    - Jest
  tips:
    - Use the `describe` function to group your tests
    - Use the `test` function to write individual tests
  examples:
    - code: |
        function sum(a, b) {
          return a + b;
        }
      tests: |
        describe("sum", () => {
          test("adds 1 + 2 to equal 3", () => {
            expect(sum(1, 2)).toBe(3);
          });
          test("adds 0 + 0 to equal 0", () => {
            expect(sum(0, 0)).toBe(0);
          });
        })
...

Save the file as testaurant.yaml in your project directory, then run the following command:

testaurant auto-test --input-file /path/to/file.js

This will generate tests for /path/to/file.js using the default options specified in testaurant.yaml.

Options

--input-file: The path to the file to generate tests for.
--output-file: The path to the file to write the generated tests to.
--api-key: Your OpenAI API key.
--model: The name of the GPT-3 model to use.
--techs: An array of technologies to use (e.g. "jest").
--tips: An array of tips to include in the prompt.
--examples: An array of example code snippets with corresponding test cases.
--config: The path to a configuration file to use.

testaurant's People

Contributors

jadrizk avatar

Stargazers

 avatar Ahmad Madi avatar Lance Tipton avatar Ady Levy avatar Sarkis Kovlekjian avatar

Watchers

 avatar  avatar Ahmad Madi avatar Sarkis Kovlekjian 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.