Wonderful Idea. Good Work  Arnold.

On Tue, Apr 26, 2022 at 4:05 PM Arnold Galovics <[email protected]> wrote:

> Hi all,
>
> I wanted to bring awareness to a potential improvement in the integration
> tests within Fineract.
>
> I bet all of us have seen the difficulty with them. When dealing with API
> calls, there are raw Map types everywhere. We don't know if there's gonna
> be an integer there, a String, a long or what; we don't know what
> properties will be there in a certain response; and the worst thing is, we
> don't know if it's in line with the actual implementation.
> Just to give you an idea:
>
> HashMap accountDetails =
> FixedDepositAccountHelper.getFixedDepositAccountById(...);
> Float maturityAmount =
> Float.valueOf(accountDetails.get("maturityAmount").toString());
>
> Very difficult to maintain. While I was fixing a bug around Client Address
> creation, I thought I could do it better and in a typesafe manner.
> So, I had this idea to utilize the fineract-client module that has
> generated request/response models based on the APIs we have in Fineract.
>
> And while fixing the bug, I used the generated code to write 2 integration
> tests to cover the bugfixes. It's way more easier than dealing with Maps;
> and there's one additional benefit to this approach.
>
> Even though fineract-client is another module people can use when
> integrating with Fineract, we are not testing it and it's definitely a gap.
>
> If I ask whether the fineract-client module is usable and working as
> expected, I don't think most of us will have a reliable answer because
> there's literally no automation in place to test those models. And that's
> the great thing about using the client module in integration tests as well
> because on one hand we're testing the Fineract functionality we want to and
> through those tests, we are testing the fineract-client module as well.
>
> Here's the 2 tests:
> -
> https://github.com/apache/fineract/blob/develop/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java#L219
> -
> https://github.com/apache/fineract/blob/develop/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientTest.java#L250
>
> Long story short, I think it would be really nice if everybody would use
> the client module for future integration tests because there's no downside
> to it but will ensure easier maintainability while making sure the client
> module is compatible with the REST API.
>
> Hope that makes sense.
> Let me know your thoughts.
>
> Best,
> Arnold
>

Reply via email to