Elegant way to create separate DARs for building and testing?

We have a test scenario/script where we a simple template, which we don’t want to load when the DAR is loaded on the ledger.
What is the recommended way to have a business.dar to contain only business templates and to build a separate test.dar to run the tests? Maybe using business.dar as a module in the test.dar? Or simply build them slightly differently to exclude/include test dir?

4 Likes

The most robust and cleanest solution is to have two projects, one for your actual code and then a separate project for your tests that depends on the DAR of the main project via dependencies.
However, that can be a bit inconvenient for testing so there are some ways around that by making use of the source field. I’ve described that approach in How to build dars but not include scenarios?.

6 Likes