Test Gru

Test Gru

Contribute to mgl-sh21/testgru-example development by creating an account on GitHub.

Git管理工具
访问服务器

README

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: connect@gru.ai,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

Name Type Required Example Value or Default Value Description
version string No 0.1 Version infomation
global object Required - Global confignation
global.setup array Required - Configuration Actions
global.cleanup array No - Cleanup Actions
pipeline PipelineConfig Required - Pipeline Configuration
pipeline.runTest object Required - Run Test Configuration
pipeline.runTest.exec array Required - Execute Command
pipeline.runTest.pre array No - Preprocessing Command
pipeline.runTest.post array No - Post-processing Command
pipeline.updateSource object No - Update Source Configuration
pipeline.updateSource.post array Required - Update Preprocessing Command
settings SettingsConfig No - Set Configuration
settings.exportFunctionOrClass string (allow not-allow) "allow" - Set Configuration
settings.include array No src Inclusions
settings.mockIgnore array No ["lodash", "ajv"] Mock Exclusions
settings.testPlacementStrategies array No The next chapter mainly introduces Test 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

推荐服务器

AIO-MCP Server

AIO-MCP Server

🚀 All-in-one MCP server with AI search, RAG, and multi-service integrations (GitLab/Jira/Confluence/YouTube) for AI-enhanced development workflows. Folk from

精选
本地
https://github.com/Streen9/react-mcp

https://github.com/Streen9/react-mcp

react-mcp 与 Claude Desktop 集成,能够根据用户提示创建和修改 React 应用程序。

精选
本地
mcp-codex-keeper

mcp-codex-keeper

作为开发知识的守护者,为 AI 助手提供精心策划的最新文档和最佳实践访问权限。

精选
db-mcp-tool

db-mcp-tool

一个强大的模型上下文协议(MCP)工具,用于探索和管理不同类型的数据库,包括 PostgreSQL、MySQL 和 Firestore。

精选
Project Handoffs MCP Server

Project Handoffs MCP Server

通过基于项目的组织方式,促进 AI 会话的交接和后续步骤的跟踪,从而支持任务优先级排序和无缝工作流程管理。

本地
Code Knowledge MCP Server

Code Knowledge MCP Server

为增强代码理解和管理,提供项目记忆库和 RAG 上下文提供器,通过向量嵌入,与 RooCode 和 Cline 集成。

本地
OSP Marketing Tools MCP Server

OSP Marketing Tools MCP Server

支持与任何支持 MCP 的 LLM 客户端无缝集成,以使用 Open Strategy Partners 的方法论创建和优化技术内容和产品定位。

本地
MCP Server Neurolorap

MCP Server Neurolorap

将文件和目录中的代码收集到一个 Markdown 文档中的 MCP 服务器。

本地
Linear MCP Server

Linear MCP Server

使 AI 代理能够以编程方式在 Linear 平台上管理问题、项目和团队。

本地
Dart MCP Server

Dart MCP Server

一个可分发的模型上下文协议(MCP)服务器,它公开 Dart SDK 命令,用于 AI 驱动的开发。该服务器通过实现模型上下文协议(MCP),弥合了 AI 编码助手与 Dart/Flutter 开发工作流程之间的差距。

本地