Skip to content
Discussions/App Development/How to achieve test coverage choice 100%? - Has been solvedForum ↗

How to achieve test coverage choice 100%? - Has been solved

App Development4 posts767 views8 likesLast activity Aug 2021
NR
nr185OP
Aug 2021

Hi DAML’ers,
I have solved this “silly” question :face_with_hand_over_mouth:

Thanks all.


Hi DAML’ers
I just finished my very first DAML code. That was very fun!
Now, I need to test my code. I had create a test scenario and run this command :

daml test --show-coverage --all

However, it always returns “test coverage: templates 100%, choices 89%”
So, how to make the coverage choice becomes 100% ?
because I think I have added all of the choices in test scenario.

QU
quidagis
Aug 2021

Hi @nr185, well done :grinning:

If you can, would you be able to briefly show how you fixed it? That way others who may happen upon the something similar, can see a potential method to help themselves.

NR
nr185
Aug 2021

Yes, to get 100% test coverage both in template creation and choice execution, we need to ensure

  1. all templates have been created
  2. all choices have been executed both in exerciseCmd and archiveCmd.

Thus, when you run this command :
daml test --show-coverage --all

the result will be :

test coverage: templates 100%, choices 100%
templates never created:
choices never executed:

Yah, that’s all what I did yesterday. Have a great weekend ! :slight_smile:

QU
quidagis
Aug 2021

Thank you for adding that :+1:t2:

← Back to Discussions