|
1 |
| -# api-testing-bot |
| 1 | +<h1 align="center"> |
| 2 | + <img src="https://raw.githubusercontent.com/rwth-acis/api-testing-bot/main/.github/images/logo.png" width="120px"/><br/> |
| 3 | + API Testing Bot |
| 4 | +</h1> |
| 5 | + |
| 6 | +<p align="center"> |
| 7 | +<img src="https://github.com/rwth-acis/api-testing-bot/workflows/Java%20CI%20with%20Gradle/badge.svg?branch=main"/> |
| 8 | +</p> |
| 9 | + |
| 10 | +## ⚙️ Setup/Usage |
| 11 | + |
| 12 | +First, set up the bot in the [Social-Bot-Framework](https://github.com/rwth-acis/Social-Bot-Framework). |
| 13 | +Both the bot model and the NLU training data can be found in the `bot-model` directory. |
| 14 | +The bot uses a backend service which is included in this repository. |
| 15 | +The easiest way to use the service is to build (or pull) the Docker image and run the service as a container. |
| 16 | +The bot can be used in different ways and on different platforms: |
| 17 | + |
| 18 | +### 1. Usage with CAE & RocketChat |
| 19 | + |
| 20 | +If the bot is a member of a RocketChat channel that is linked to a CAE project, test cases can be modeled via chat. |
| 21 | +The bot can be triggered by sending a message such as "model a test". |
| 22 | +As soon as the modeling is completed, the test case is forwarded to the CAE and proposed there in the Test Editor. |
| 23 | + |
| 24 | +Dependencies: |
| 25 | + |
| 26 | +- [las2peer-project-service](https://github.com/rwth-acis/las2peer-project-service) |
| 27 | +- [CAE](https://github.com/rwth-acis/CAE) |
| 28 | + |
| 29 | +### 2. Usage on GitHub |
| 30 | + |
| 31 | +The bot may be used within GitHub repositories by connecting it to a GitHub app. |
| 32 | +Therefore, the app id and a private key are required. |
| 33 | +Please note that the private key needs to be converted from PKCS#1 to PKCS#8. |
| 34 | +In the bot model, the `Authentication Token` of the GitHub issue or pull request messenger needs to be set to `[App Id]:[App Private Key]`. |
| 35 | +Use the private key in PKCS#8 format, but remove the first and last line before copying it. |
| 36 | +Also, set the webhook URL of the app to `.../apitestingbot/github/webhook/{gitHubAppId}`. |
| 37 | + |
| 38 | +Then, the bot can be triggered within issues/pull requests by sending a message such as "model a test". |
| 39 | +Once a test case has been modeled, the bot generates Java JUnit test code and comments it. |
| 40 | + |
| 41 | +In pull requests, the bot may also propose spec-based test cases if it can access the developed service's OpenAPI documentation. |
| 42 | +Read the [repository adjustment guide](repo_adjustment_guide.md) for more information. |
| 43 | + |
| 44 | +Dependencies: |
| 45 | + |
| 46 | +- [CAE-Code-Generation-Service](https://github.com/rwth-acis/CAE-Code-Generation-Service) |
| 47 | +- [api-test-gen-service](https://github.com/rwth-acis/api-test-gen-service) |
| 48 | + |
| 49 | + |
| 50 | +## 🐳 Docker Environment Variables |
| 51 | + |
| 52 | +Depending on the use case different environment variables are required: |
| 53 | + |
| 54 | +| Environment Variable | Description | Required? | |
| 55 | +|--------------------------|----------------------------------------------------------------------------------------------|---------------------| |
| 56 | +| `BOT_MANAGER_URL` | REST API URL of Bot Manager Service ending with `/SBFManager`. | Yes | |
| 57 | +| `CODEX_API_TOKEN` | Token for accessing the OpenAI/Codex API. | Yes | |
| 58 | +| `CAE_BACKEND_URL` | REST API URL of CAE Model Persistence Service ending with `/CAE`. | Only in 1. Use-case | |
| 59 | +| `GITHUB_APP_ID` | Id of GitHub app that the bot should use. | Only in 2. Use-case | |
| 60 | +| `GITHUB_APP_PRIVATE_KEY` | Private key of GitHub app that the bot should use (already needs to be converted to PKCS#8). | Only in 2. Use-case | |
0 commit comments