Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Best Practice on Structuring Daml Tests?Forum ↗

Best Practice on Structuring Daml Tests?

App Development2 posts127 viewsLast activity Apr 2022
RI
rikotacardsOP
Apr 2022

Is there a Daml “best practice” for structuring tests?
For example, in the DA Market place repo da-marketplace/daml at main · digital-asset/da-marketplace · GitHub

The tests have its own directory, I suspect its because we are following the best practice for structuring a haskell project as shown in the link below:
https://wiki.haskell.org/Structure_of_a_Haskell_project

Is there anything against structuring the tests such as

/daml
   /Account
      /Main
          Account.daml ( defined as module Main.Account where) 
      /Test
         Account.daml (defined as module Test.Account where, and we import the above Main.Account)

So that each daml module is accompanied by a test along side?

Would like to know if there is a preferred or recommended way, thanks!

ST
Stephen
Apr 2022

Marketplace contains many library components, for which having separate tests is appropriate. In case of developing a library, I suggest following its structure.

However, for developing a typical Daml application, I would not be so strict. If you find it useful to have instant feedback in Daml Studio on tests that fail as you make updates to your contracts, as will appear under Script results as you edit a Daml source file, then go ahead and put the scripts in the same file as the templates they’re testing.

← Back to Discussions