# How to mark test case failed if validation not matched

**URL:** <https://forum.katalon.com/t/how-to-mark-test-case-failed-if-validation-not-matched/38719>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [January 16, 2020, 10:50am UTC](https://forum.katalon.com/t/how-to-mark-test-case-failed-if-validation-not-matched/38719 "2020-01-16T10:50:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chickoontlk](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/chickoontlk/32/10611_2.png) [@chickoontlk](https://forum.katalon.com/u/chickoontlk)\
**Post date:** [January 16, 2020, 10:50am UTC](https://forum.katalon.com/t/how-to-mark-test-case-failed-if-validation-not-matched/38719/1 "2020-01-16T10:50:06Z")

</div>

Hi,  
if (1 == 1) {

```
	println('Correct')

    WebUI.closeBrowser() 
	
} else {
   
	 	println('not correct')
	
	 	//mark fail   
   
	    WebUI.closeBrowser()
}

```

How can I mark the test case failed in else condition if it will not match

---

<div class="post-metadata">

**Author:** ![Andrej\_Podhajsky](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andrej_podhajsky/32/1055_2.png) [@Andrej\_Podhajsky](https://forum.katalon.com/u/Andrej_Podhajsky)\
**Post date:** [January 16, 2020, 11:29am UTC](https://forum.katalon.com/t/how-to-mark-test-case-failed-if-validation-not-matched/38719/2 "2020-01-16T11:29:24Z")

</div>

KeywordUtil.markFailed()

> [@KeywordUtil.markFailed and -markFailedAndStop throws exception](http://forum.katalon.com/t/keywordutil-markfailed-and-markfailedandstop-throws-exception/33932):
>
> Hello I have seen these errors other Katalon users for a long time. Is there coming any fix for this bug? If using KeywordUtil.markFailed(“Your error message”) and/or KeywordUtil.markFailedAndStop(“Your error message”) Katalon throws “com.kms.katalon.core.exception.StepFailedException”. And no matter if using “import com.kms.katalon.core.util.KeywordUtil” or/and(together) “import com.kms.katalon.core.util.KeywordUtil as KeywordUtil”. Example if I use command KeywordUtil.markFailed(“Your er…
