RFR: 1627: Add tests for bot factories [v2]
Zhao Song
zsong at openjdk.org
Tue Oct 11 22:12:57 UTC 2022
On Tue, 11 Oct 2022 21:48:50 GMT, Zhao Song <zsong at openjdk.org> wrote:
>> Add some tests for BotFactories.
>
> Zhao Song has updated the pull request incrementally with two additional commits since the last revision:
>
> - Use TestBotFactory
> - delete json file
bots/csr/src/test/java/org/openjdk/skara/bots/csr/CSRBotFactoryTest.java line 178:
> 176: }
> 177: }
> 178: }
I tried to write the test with `TestBotFactory`, but I still couldn't get the advantage of using `TestBotFactory`.
**Using `TestBotRunnerConfiguration`:**
pros:
1. We just override two parsers in `BotRunnerConfiguration`, so we could go through most of code in real `BotRunnerConfiguration` and `BotConfiguration`.
2. We don't need to create RepositoryHost or IssueHost manually.
cons:
1. we need the config of forges and issueTrackers
--------------------------------------------------------------------------------------------------------------
**Using `TestBotFactory`**:
pros:
1. we don't need the config of forges and issueTrackers
cons:
1. we need to create all HostedRepositories and issueProjects manually because the fields in TestBotFactory is `private final Map<String, HostedRepository> hostedRepositories;` & `private final Map<String, IssueProject> issueProjects;`, otherwise, the contents in the bots will be wrong.
2. `BotConfiguration` in `TestBotFactory` is not the real one we use.
--------------------------------------------------------------------------------------------------------------
All in all, I think use the `TestBotRunnerConfiguration` will be more realistic.
-------------
PR: https://git.openjdk.org/skara/pull/1393
More information about the skara-dev
mailing list