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. We have prepared an open-source project as an example to help you quickly start.
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.
Enter Test Gru
Click the top left corner to select Test Gru.
Install Github Application
Follow the steps to install Test Gru.
Then select a repo, perform the configuration.
grutest.yaml
Configuration file example
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:
then you can configure testPlacementStrategies
like this
co-located
If your project structure is as follows:
then you can configure testPlacementStrategies
like this
Trigger TestGru to work
Auto Trigger 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.
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.
Manual Trigger
You can manually trigger Test Gru on the Gru.ai.
It can be triggered by PR or existing code files.
Quick Start with Example Repository
- Fork github.com/gru-agent/testgru-example
- Install App and get configuration from code repo
- dispatch src/user.ts
- Test Gru submits a PR