# \#test

**URL:** https://forum.canton.network/tag/test/25.md

[Latest](https://forum.canton.network/latest.md) · [Categories](https://forum.canton.network/categories.md) · [Tags](https://forum.canton.network/tags.md)

---

## [How to test witnessing/divulgence using DAML Script?](https://forum.canton.network/t/how-to-test-witnessing-divulgence-using-daml-script/7304)

<div class="topic-metadata">

**Author:** [@jvelasco.intellecteu](https://forum.canton.network/u/jvelasco.intellecteu)\
**Replies:** 3\
**Last updated:** [July 15, 2024, 2:54pm UTC](https://forum.canton.network/t/how-to-test-witnessing-divulgence-using-daml-script/7304 "2024-07-15T14:54:01Z")

</div>

Hello, Is there any way to test (using Daml script) that a contract has been witnessed or divulged to a party? Best Jose

---

## [Daml test failure - large scenario (sdk 2.8.x)](https://forum.canton.network/t/daml-test-failure-large-scenario-sdk-2-8-x/7153)

<div class="topic-metadata">

**Author:** [@jvelasco.intellecteu](https://forum.canton.network/u/jvelasco.intellecteu)\
**Replies:** 5\
**Last updated:** [March 12, 2024, 3:49pm UTC](https://forum.canton.network/t/daml-test-failure-large-scenario-sdk-2-8-x/7153 "2024-03-12T15:49:44Z")

</div>

Hi, I’m upgrading the code base of a project from daml-finance 1.3.0 / sdk 2.7.0 to daml-finance 1.3.11 / sdk 2.8.0. After doing the migration I’m getting an error when I run a large scenario using daml test or daml s…

---

## [Behavior-driven-development with daml-cucumber](https://forum.canton.network/t/behavior-driven-development-with-daml-cucumber/7115)

<div class="topic-metadata">

**Author:** [@ali-abrar](https://forum.canton.network/u/ali-abrar)\
**Replies:** 1\
**Last updated:** [February 21, 2024, 12:11pm UTC](https://forum.canton.network/t/behavior-driven-development-with-daml-cucumber/7115 "2024-02-21T12:11:44Z")

</div>

We (Obsidian Systems) have been using cucumber gherkin specifications on some of our daml-based projects. They’re great for building specifications that can be read both by a human and by gherkin tooling. What we lacked,…

---

## [My test case still shows "Unhandled exception" even if I try-catch-ed it?](https://forum.canton.network/t/my-test-case-still-shows-unhandled-exception-even-if-i-try-catch-ed-it/6192)

<div class="topic-metadata">

**Author:** [@charlie.ng](https://forum.canton.network/u/charlie.ng)\
**Replies:** 3\
**Last updated:** [March 1, 2023, 8:23am UTC](https://forum.canton.network/t/my-test-case-still-shows-unhandled-exception-even-if-i-try-catch-ed-it/6192 "2023-03-01T08:23:54Z")

</div>

Hi there, Is this a bug when I try to write the test case - testRollback? Because the compiler would still complain that it’s a “Unhandled exception”. And furthermore when I run daml test --show-coverage , it’ll sho…

---

## [Create-daml-app testing not working](https://forum.canton.network/t/create-daml-app-testing-not-working/5845)

<div class="topic-metadata">

**Author:** [@cdfwb](https://forum.canton.network/u/cdfwb)\
**Replies:** 1\
**Last updated:** [January 3, 2023, 11:31am UTC](https://forum.canton.network/t/create-daml-app-testing-not-working/5845 "2023-01-03T11:31:54Z")

</div>

I am following the tutorial here: Testing Your Web App — Daml SDK 2.5.0 documentation to test the demo, but I got following error when I did npm run test

---

## [How to mock useStreamQueries in jest test?](https://forum.canton.network/t/how-to-mock-usestreamqueries-in-jest-test/2095)

<div class="topic-metadata">

**Author:** [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Replies:** 3\
**Last updated:** [February 17, 2021, 6:26pm UTC](https://forum.canton.network/t/how-to-mock-usestreamqueries-in-jest-test/2095 "2021-02-17T18:26:54Z")

</div>

We’d like to render a page in a test which connects to the ledger during rendering. How would be possible to mock useStreamQueries to always return an empty contract list? We could not figure out how to do this with jes…

---

## [Lib-daml-jvm-test fails to shutdown sandbox](https://forum.canton.network/t/lib-daml-jvm-test-fails-to-shutdown-sandbox/4428)

<div class="topic-metadata">

**Author:** [@huw](https://forum.canton.network/u/huw)\
**Replies:** 1\
**Last updated:** [April 29, 2022, 8:31am UTC](https://forum.canton.network/t/lib-daml-jvm-test-fails-to-shutdown-sandbox/4428 "2022-04-29T08:31:51Z")

</div>

I’m trying to use GitHub - digital-asset/lib-daml-jvm-test: A library providing functions for testing DAML applications on JVM. on Windows Server 2016. I’ve tried copying the example from the README and can see it is log…

---

## [Lib-daml-jvm-test: cannot specify contract id seeding](https://forum.canton.network/t/lib-daml-jvm-test-cannot-specify-contract-id-seeding/4429)

<div class="topic-metadata">

**Author:** [@huw](https://forum.canton.network/u/huw)\
**Replies:** 1\
**Last updated:** [April 28, 2022, 3:16pm UTC](https://forum.canton.network/t/lib-daml-jvm-test-cannot-specify-contract-id-seeding/4429 "2022-04-28T15:16:38Z")

</div>

It seems that lib-daml-jvm-test does not have any way to specify contract id seeding method for the sandbox. I’m open to doing a PR for this, I imagine it wouldn’t be too hard to add.

---

## [How to get the runtime of tests (scripts) one by one](https://forum.canton.network/t/how-to-get-the-runtime-of-tests-scripts-one-by-one/3794)

<div class="topic-metadata">

**Author:** [@gaborh](https://forum.canton.network/u/gaborh)\
**Replies:** 3\
**Last updated:** [January 26, 2022, 2:58pm UTC](https://forum.canton.network/t/how-to-get-the-runtime-of-tests-scripts-one-by-one/3794 "2022-01-26T14:58:00Z")

</div>

I would like to see the runtime for each test, one by one. With daml test and --log-level=DEBUG, I think I am able to see the length of time it took to run all the tests. How is it possible to get results for each test…

---

## [Debug calls in a script - not visible in the logs](https://forum.canton.network/t/debug-calls-in-a-script-not-visible-in-the-logs/3793)

<div class="topic-metadata">

**Author:** [@gaborh](https://forum.canton.network/u/gaborh)\
**Replies:** 1\
**Last updated:** [January 26, 2022, 12:32pm UTC](https://forum.canton.network/t/debug-calls-in-a-script-not-visible-in-the-logs/3793 "2022-01-26T12:32:57Z")

</div>

I have the following code: stuff : Script () stuff = do debug "START" # do things ... debug "END" It prints the debug texts in the “Trace” section in Daml Studio but how is it that I do not see them in …

---

## [Does the \`daml test\` JUnit output support reporting coverage information?](https://forum.canton.network/t/does-the-daml-test-junit-output-support-reporting-coverage-information/3279)

<div class="topic-metadata">

**Author:** [@georg](https://forum.canton.network/u/georg)\
**Replies:** 1\
**Last updated:** [October 11, 2021, 8:59am UTC](https://forum.canton.network/t/does-the-daml-test-junit-output-support-reporting-coverage-information/3279 "2021-10-11T08:59:48Z")

</div>

I’m not even sure the JUnit output format supports coverage. But if it does, do we support reporting it?

---

## [Testing strategy for non-contract related Daml code](https://forum.canton.network/t/testing-strategy-for-non-contract-related-daml-code/2924)

<div class="topic-metadata">

**Author:** [@sully](https://forum.canton.network/u/sully)\
**Replies:** 2\
**Last updated:** [August 10, 2021, 2:53pm UTC](https://forum.canton.network/t/testing-strategy-for-non-contract-related-daml-code/2924 "2021-08-10T14:53:21Z")

</div>

I am writing tests for some Daml code I am writing that does not use the ledger at all. I’m currently writing my tests as I would for contracts, using Script. Something like this made-up example: testDedup : Script () t…

---

## [Testing Templates Using Daml Script (Military Instructional Format)](https://forum.canton.network/t/testing-templates-using-daml-script-military-instructional-format/2474)

<div class="topic-metadata">

**Author:** [@quidagis](https://forum.canton.network/u/quidagis)\
**Replies:** 9\
**Last updated:** [May 4, 2021, 11:20pm UTC](https://forum.canton.network/t/testing-templates-using-daml-script-military-instructional-format/2474 "2021-05-04T23:20:53Z")

</div>

Preamble: I have been working through the documentation, starting at an Introduction to Daml and submitting feedback while doing that. After some feedback about the actual logical connections to the instructions and the…

---

## [Connection refused in react.js jest test (websocket closed)](https://forum.canton.network/t/connection-refused-in-react-js-jest-test-websocket-closed/2092)

<div class="topic-metadata">

**Author:** [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Replies:** 1\
**Last updated:** [February 16, 2021, 9:58am UTC](https://forum.canton.network/t/connection-refused-in-react-js-jest-test-websocket-closed/2092 "2021-02-16T09:58:44Z")

</div>

How can I fix Error: connect ECONNREFUSED 127.0.0.1:3000 when running npm test? The tests seem to pass: npm test -- --watchAll=false \> daml-demo@0.1.0 test /home/circleci/project/ui \> react-scripts test --testURL='htt…

---

## [How to test Canton bootstrap script non-interactively in a ci job?](https://forum.canton.network/t/how-to-test-canton-bootstrap-script-non-interactively-in-a-ci-job/637)

<div class="topic-metadata">

**Author:** [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Replies:** 1\
**Last updated:** [June 12, 2020, 11:11am UTC](https://forum.canton.network/t/how-to-test-canton-bootstrap-script-non-interactively-in-a-ci-job/637 "2020-06-12T11:11:22Z")

</div>

I’d like to test if a Canton script works in a CI job, so I need something which returns a nonzero error code on failure (e.g. if the script has invalid syntax, or causes runtime exception).

---

## [Can we mock contract id when testing triggers?](https://forum.canton.network/t/can-we-mock-contract-id-when-testing-triggers/519)

<div class="topic-metadata">

**Author:** [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Replies:** 1\
**Last updated:** [May 21, 2020, 3:29pm UTC](https://forum.canton.network/t/can-we-mock-contract-id-when-testing-triggers/519 "2020-05-21T15:29:53Z")

</div>

Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ pos…
