Daml Test against separate dar
- Leonid_RozenbergOP 3
I separate my tests into a different dar. When I execute them, I believe that the test coverage shows 100% because it does not have the path to the models:
$ daml test --show-coverage daml/RoleTests.daml:testSetup: ok, 1 active contracts, 2 transactions. test coverage: templates 100%, choices 100% templates never created: choices never executed:But then when I used
--include$ daml test --show-coverage --include ../../models/daml File: daml/RoleTests.daml Hidden: no Range: 16:20-16:26 Source: typecheck Severity: DsError Message: daml/RoleTests.daml:16:20: error: • Couldn't match expected type 'Party' with actual type 'Party' NB: 'Party' is defined in 'DA.Internal.LF' 'Party' is defined in 'DA.Internal.LF' • In the 'operator' field of a record In the first argument of 'createCmd', namely 'Genesis {operator = change}' In a stmt of a 'do' block: createCmd Genesis {operator = change} ...Is
--includethe wrong argument? - cocreature 3
By default,
daml test --show-coverageruns only tests in the main dalf (so the one originating from your current project) and it reports coverage for only the templates in that dalf. That matches the usecase where you assume your dependencies are out of your control so you don’t care about writing tests for them.If you want to run tests in your dependencies as well and report coverage against templates in your dependencies, you can use the
daml test --show-coverage --allflag.--includeis more of an internal option for adding extra source files to a project. I’d recommend against trying to use that.