RFR: 1627: Add tests for bot factories [v2]
Zhao Song
zsong at openjdk.org
Wed Oct 12 15:55:20 UTC 2022
On Tue, 11 Oct 2022 22:09:34 GMT, Zhao Song <zsong at openjdk.org> wrote:
>> 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.
Hi @erikj79 , if you have any time, please have a look at this comment.
-------------
PR: https://git.openjdk.org/skara/pull/1393
More information about the skara-dev
mailing list