# Is there a specific way to stop the test/simulation in case condition failure?

**URL:** <https://verificationacademy.com/forums/t/is-there-a-specific-way-to-stop-the-test-simulation-in-case-condition-failure/32437>\
**Category:** UVM\
**Tags:** UVM, uvm\_error, assert\
**Created:** [October 19, 2016, 11:44am UTC](https://verificationacademy.com/forums/t/is-there-a-specific-way-to-stop-the-test-simulation-in-case-condition-failure/32437 "2016-10-19T11:44:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![MaximKobzar](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/m/57b2e6/32.png) [@MaximKobzar](https://verificationacademy.com/forums/u/MaximKobzar)\
**Post date:** [October 19, 2016, 12:54pm UTC](https://verificationacademy.com/forums/t/is-there-a-specific-way-to-stop-the-test-simulation-in-case-condition-failure/32437/2 "2016-10-19T12:54:06Z")

</div>

_In reply to [saritr](https://verificationacademy.com/forums/t/is-there-a-specific-way-to-stop-the-test-simulation-in-case-condition-failure/32437):_

If you are not okay with error message in test, code in test:

```verilog

virtual task main_phase(uvm_phase phase);
  super.main_phase(phase);
  wait(my_condition_is_true) begin
    foreach(env.my_agent[i])
       env.my_agent[i].sequencer.stop_sequences();
  end
  `uvm_info(get_full_name(), "I kill my test, because ...", UVM_NONE)
endtask

```

Or if you are okay with error message in test, add +UVM\_MAX\_QUIT\_COUNT=1 in SIM\_OPTS.

---

_[View the full topic](https://verificationacademy.com/forums/t/is-there-a-specific-way-to-stop-the-test-simulation-in-case-condition-failure/32437)._
