quarkiverse / quarkus-github-app

Develop your GitHub Apps in Java with Quarkus.
https://docs.quarkiverse.io/quarkus-github-app/dev/index.html
Apache License 2.0
62 stars 29 forks source link

Make testing easier and unified #504

Open The-Huginn opened 1 year ago

The-Huginn commented 1 year ago

I would like to discuss an easier way to test github apps. I can see other github bots trying to do the same and test their applications with slightly different approaches. It would be best to unify this process.

There could be 2 main areas to improve on this.

  1. Create JSON processors for most common events such as Pull Request. It will make tests more readable and configurable without the need of having many slightly different *.json payloads with Pull Requests.
  2. Create easier mocking for most common cases and events (similarly to first point)

Example of JSON processor in our repo

Example of mocking builder (In case the PR was updated please use this link and find file MockedGHPullRequestProcessor). Builder and usage

We would need to find a trade-off between mocking too much and covering just the basics. Also we could provide mocking for classes not extending GHObject as they are not able to use GitHubMockContext#ghObject mocking method such as GHPullRequestCommitDetail.

Quick links to quarkus and hibernate bots