# Debugging tests

**URL:** <https://datashield.discourse.group/t/debugging-tests/442>\
**Category:** Developer support\
**Created:** [17 September 2021 16:46 UTC](https://datashield.discourse.group/t/debugging-tests/442 "2021-09-17T16:46:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tombishop](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/tombishop/32/23_2.png) [@tombishop](https://datashield.discourse.group/u/tombishop)\
**Post date:** [17 September 2021 16:46 UTC](https://datashield.discourse.group/t/debugging-tests/442/1 "2021-09-17T16:46:34Z")

</div>

I am trying to write some tests

In the test I first make my call to a client side function which should return a value, so my test can check that value:

```auto
test_that("simple synthetic test", {
    res <- ds.syn2(data="D", method = "cart", m = 1, seed = 123)

```

But the call is failing and I get the familiar “check datashield.errors()”. But how can I do that in the context of the testing framework? Tom

---

<div class="post-metadata">

**Author:** ![swheater](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/swheater/32/182_2.png) [@swheater](https://datashield.discourse.group/u/swheater)\
**Post date:** [17 September 2021 17:05 UTC](https://datashield.discourse.group/t/debugging-tests/442/2 "2021-09-17T17:05:57Z")

</div>

Tom,

The “argument tests” have examples of checking “datashield.errors()”, for example, [https://github.com/datashield/dsBaseClient/blob/v6.2-dev/tests/testthat/test-arg-ds.foobar.R](https://github.com/datashield/dsBaseClient/blob/v6.2-dev/tests/testthat/test-arg-ds.foobar.R).

Note the use of “expect\_error” around the call to the method.

Stuart

---

<div class="post-metadata">

**Author:** ![tombishop](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/tombishop/32/23_2.png) [@tombishop](https://datashield.discourse.group/u/tombishop)\
**Post date:** [17 September 2021 17:43 UTC](https://datashield.discourse.group/t/debugging-tests/442/3 "2021-09-17T17:43:03Z")

</div>

ah the “expect\_error” is the magic I was looking for!

Thanks
