# Testing Contract Archived

**URL:** <https://forum.canton.network/t/testing-contract-archived/4804>\
**Category:** App Development\
**Created:** [June 29, 2022, 5:15am UTC](https://forum.canton.network/t/testing-contract-archived/4804 "2022-06-29T05:15:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sungroa](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sungroa/32/4033_2.png) [@sungroa](https://forum.canton.network/u/sungroa)\
**Post date:** [June 29, 2022, 5:15am UTC](https://forum.canton.network/t/testing-contract-archived/4804/1 "2022-06-29T05:15:01Z")

</div>

Hello all, I was having difficulty finding documentation for this and I wasn’t sure how to go about it. How do we test that a given contract is archived? I kinda hack it by trying submitMustFail with a choice in the contract, but that is not a desired solution since I don’t want it to pass just because that function changes behavior and the contract doesn’t actually get archived. Thank you!

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [June 29, 2022, 12:40pm UTC](https://forum.canton.network/t/testing-contract-archived/4804/2 "2022-06-29T12:40:52Z")

</div>

Hi @sungroa , I would use the [queryContractId](https://docs.daml.com/daml-script/api/Daml-Script.html#function-daml-script-querycontractid-59269) function in script:

```haskell
do
  ...
  cid <- somethingThatCreatesAContractWithStakeholder p
  ...
  -- Check that the contract still exists
  args <- queryContractId p cid
  assertMsg (show cid <> " should be active") (isSome args)
  ...
  somethingThatArchives cid
  ...
  -- Check that the contract no longer exists
  args <- queryContractId p cid
  assertMsg (show cid <> " should be inactive") (isNone args)

```

---

<div class="post-metadata">

**Author:** ![sungroa](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sungroa/32/4033_2.png) [@sungroa](https://forum.canton.network/u/sungroa)\
**Post date:** [June 29, 2022, 5:13pm UTC](https://forum.canton.network/t/testing-contract-archived/4804/3 "2022-06-29T17:13:26Z")

</div>

That works, thank you!
