A favicon of Test Gru

Test Gru

Automate the addition of unit tests to your codebase.

Installation

Installing for Claude Desktop

Manual Configuration Required

This MCP server requires manual configuration. Run the command below to open your configuration file:

npx mcpbar@latest edit -c claude

This will open your configuration file where you can add the Test Gru MCP server manually.

Forget about Unit Test, you get covered automatically.

This is the example repo for Test Gru. Test Gru will help you add unit test automatically. Here is the video to show how Test Gru works.

Test gru is still in testing phase. If you have any question, please connect to us: [email protected],or join our discord.

Currently, Test Gru only supports Node.js/TypeStript. We are gradually adding support for other languages.

Creat Test Gru Account

Log in at Gru.ai. Test Gru currently only supports use with GitHub accounts. You need a GitHub account to log in to gru.ai.

image

image

Enter Test Gru

Click the top left corner to select Test Gru.

image

Install Github Application

Follow the steps to install Test Gru.

image image Then select a repo, perform the configuration. image image

Use Example For Quick Start

  1. Fork this repo
  2. Install App and get configuration from code repo image
  3. dispatch src/user.ts image
  4. Test Gru submits a PR image

grutest.yaml

Configuration file example

version: "0.1"
global:
  setup:
    - npm install
pipeline:
  runTest:
    // If your project uses ESLint and Prettier, you can configure the pre-stage here.
    // pre:
    //    - npx eslint --fix {{sourceFilePath}} 
    //    - npx prettier {{sourceFilePath}} --write
    exec:
       - npx vitest run {{testFilePath}}
    // If your project has certain requirements for the final submitted code, you can configure the post-stage here.
    // post:
    //   - npm run lint
    //   - npx tsc --noEmit
settings:
  // IF you allow TestGru to add export to your source code classes or functions when it needs to test your source code
  exportFunctionOrClass: allow
  // Location of the source code project
  include:
      - src
  // Location of the test files
  testPlacementStrategies:
    - type: co-located
      testFilePattern: "{{sourceFileName}}.spec.ts"

explanation

NameTypeRequiredExample Value or Default ValueDescription
versionstringNo0.1Version infomation
globalobjectRequired-Global confignation
global.setuparrayRequired-Configuration Actions
global.cleanuparrayNo-Cleanup Actions
pipelinePipelineConfigRequired-Pipeline Configuration
pipeline.runTestobjectRequired-Run Test Configuration
pipeline.runTest.execarrayRequired-Execute Command
pipeline.runTest.prearrayNo-Preprocessing Command
pipeline.runTest.postarrayNo-Post-processing Command
pipeline.updateSourceobjectNo-Update Source Configuration
pipeline.updateSource.postarrayRequired-Update Preprocessing Command
settingsSettingsConfigNo-Set Configuration
settings.exportFunctionOrClassstring (allow not-allow)"allow"-Set Configuration
settings.includearrayNosrcInclusions
settings.mockIgnorearrayNo["lodash", "ajv"]Mock Exclusions
settings.testPlacementStrategiesarrayNoThe next chapter mainly introducesTest Placement Strategy

About testPlacementStrategies

There are two main ways to organize test code.

centralized

If your project structure is as follows:

{% highlight TXT %} . ├── package.json ├── src │ └── sum.ts └── test └── sum.test.ts {% endhighlight %}

then you can configure testPlacementStrategies like this {% highlight YAML %} testPlacementStrategies:

  • type: centralized testDir: test testFilePattern: "{{sourceFileName}}.test.ts" {% endhighlight %}

co-located

If your project structure is as follows: {% highlight TXT %} . ├── package.json └── src ├── sum.test.ts └── sum.ts {% endhighlight %}

then you can configure testPlacementStrategies like this

{% highlight YAML %} testPlacementStrategies: - type: co-located testFilePattern: "{{sourceFileName}}.test.ts" {% endhighlight %}

Trigger Test Gru to work

Auto Rrigger by Pull Request

When you complete the configuration, Test Gru will automatically take over your repository. Whenever you submit a PR, Test Gru will automatically detect software that requires unit tests and add tests for it.

image

After Gru completes writing the test code, it will run the tests. Once it confirms there are no issues with the test code, it will submit a PR with the unit test code to the current PR.

image

Manual Trigger

You can manually trigger Test Gru on the Gru.ai. image

It can be triggered by PR or existing code files. image

image

Share:
Details:
  • Stars


    0
  • Forks


    0
  • Last commit


    5 months ago
  • Repository age


    5 months
View Repository

Auto-fetched from GitHub .

MCP servers similar to Test Gru:

 

 
 
  • Stars


  • Forks


  • Last commit


 

 
 
  • Stars


  • Forks


  • Last commit


 

 
 
  • Stars


  • Forks


  • Last commit


Test Gru: MCP Server – MCP.Bar