# Testing for expected failure

**URL:** <https://forum.elixirforum.com/t/testing-for-expected-failure/27651>\
**Category:** Questions\
**Tags:** testing, assertions\
**Created:** [December 17, 2019, 10:40pm UTC](https://forum.elixirforum.com/t/testing-for-expected-failure/27651 "2019-12-17T22:40:16Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![arjan](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/arjan/32/2737_2.png) [@arjan](https://forum.elixirforum.com/u/arjan)\
**Post date:** [December 18, 2019, 10:05pm UTC](https://forum.elixirforum.com/t/testing-for-expected-failure/27651/5 "2019-12-18T22:05:19Z")

</div>

You could use `flunk` instead to check that the execution does not reach a certain point:

```elixir
try do
  only_valid_number("x")
  flunk("this should not have happened")
catch
  _, _ -> :ok 
end

```

---

_[View the full topic](https://forum.elixirforum.com/t/testing-for-expected-failure/27651)._
