# Script failing in overall status

**URL:** <https://forum.katalon.com/t/script-failing-in-overall-status/34934>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [October 18, 2019, 9:56pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934 "2019-10-18T21:56:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpereyra](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jpereyra/32/16104_2.png) [@jpereyra](https://forum.katalon.com/u/jpereyra)\
**Post date:** [October 18, 2019, 9:56pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/1 "2019-10-18T21:56:45Z")

</div>

Hi Katalon experts,

I have the below script with an if condition that fails (overall status) when the else if is executed but all the steps finish fine

![image](https://europe1.discourse-cdn.com/katalon/optimized/2X/8/8e1424b4cd28ec481874f40fc81d68611899b890_2_690x42.png)

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/5/54febd28171b5b3390e3ed26bd0de14e3834c453.png)

```auto
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

WebUI.openBrowser('')

WebUI.navigateToUrl('https://company.portal.com/saml_login?ReturnTo=https%3A//company.portal.com/')

WebUI.setText(findTestObject('Page_Company - Sign In/input_Username_username'), 'user1')

WebUI.setEncryptedText(findTestObject('Page_company - Sign In/input_Password_password'), 'pw1')

WebUI.click(findTestObject('Page_Company - Sign In/input_Remember me_okta-signin-submit'))

WebUI.scrollToElement(findTestObject('Page_Home page portal/div_Switch to 24hr'), 0)

WebUI.click(findTestObject('Page_Home page portal/div_Switch to 24hr'))

WebUI.verifyElementPresent(findTestObject('Object Repository/Page_Home page portal/ul_clock section'), 0)

WebUI.verifyElementVisible(findTestObject('Page_Home page portal/ul_clock section'))

CustomKeywords.'ClickJS.clickUsingJS'(findTestObject('Page_Home page portal/span_Personalize Clocks'), 30)

if (WebUI.verifyElementChecked(findTestObject('Object Repository/Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form8'), 
    0)) {
    WebUI.uncheck(findTestObject('Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form8'))

    WebUI.check(findTestObject('Object Repository/Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form13'))

    WebUI.click(findTestObject('Page_Personalized Clocks portal/input_West Coast N America_op'))

    WebUI.verifyElementPresent(findTestObject('Object Repository/Page_Home page portal/span_West Coast N America'), 0)

    WebUI.verifyElementVisible(findTestObject('Page_Home page portal/span_West Coast N America'))

    WebUI.closeBrowser()
} else if (WebUI.verifyElementChecked(findTestObject('Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form13'), 
    0)) {
    WebUI.uncheck(findTestObject('Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form13'))

    WebUI.check(findTestObject('Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form8'))

    WebUI.click(findTestObject('Page_Personalized Clocks portal/input_West Coast N America_op'))

    WebUI.verifyElementPresent(findTestObject('Object Repository/Page_Home page portal/span_East Coast N America'), 0)

    WebUI.verifyElementVisible(findTestObject('Page_Home page portal/span_East Coast N America'))

    WebUI.closeBrowser()
}

```

Any idea?

Thanks,  
Ruben B

---

<div class="post-metadata">

**Author:** ![manpreet.mukkar](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/manpreet.mukkar/32/16103_2.png) [@manpreet.mukkar](https://forum.katalon.com/u/manpreet.mukkar)\
**Post date:** [October 18, 2019, 10:03pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/2 "2019-10-18T22:03:59Z")

</div>

@jpereyra The console log says it failed because the of this line

```auto
WebUI.check(findTestObject('Page_Personalized Clocks portal/input_Update this item_taxonomy_term_bulk_form8'))

```

WebUI.Check is basically toggling the checkbox or a radio button. I believe it will check a box if it is not checked before Script comes to this step or it will uncheck the box if the box is checked before Script comes to this step.

Can you please explain more here what are you trying to accomplish in this test ?

---

<div class="post-metadata">

**Author:** ![jpereyra](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jpereyra/32/16104_2.png) [@jpereyra](https://forum.katalon.com/u/jpereyra)\
**Post date:** [October 21, 2019, 9:46pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/3 "2019-10-21T21:46:32Z")

</div>

Hi @manpreet.mukkar,

But it’s weird because all the steps finish fine.

We have a clock section in our portal showing the time for different timezones and it is customizable. The script is to validate that is we make any change, the correct clock is reflected.

it validates if the object “input\_Update this item\_taxonomy\_term\_bulk\_form8” is checked, if yes, it proceed to uncheck it, then check the object “input\_Update this item\_taxonomy\_term\_bulk\_form13”, then save the changes and validate that the correct clock is showing up and close the browser. then there is the “else if” that validates if the object “input\_Update this item\_taxonomy\_term\_bulk\_form13” is checked, if yes, it proceed to uncheck it, then check the object “input\_Update this item\_taxonomy\_term\_bulk\_form8”, save the changes and validate that the clock is showing up.

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/b/b60eaa3efe5e5dec21592b542d5b2188971aa4af.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/a/ab4f7aeb2693034a1f1ce998d69678b056dbc68e.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/optimized/2X/7/7f7475b9c621eebcbd561e261329e60ccf97f025_2_690x22.png)

---

<div class="post-metadata">

**Author:** ![kesha\_shym](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kesha_shym/32/20464_2.png) [@kesha\_shym](https://forum.katalon.com/u/kesha_shym)\
**Post date:** [October 22, 2019, 7:25am UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/4 "2019-10-22T07:25:16Z")

</div>

Привет, у меня в тест кейсе на 13 шаге  
выдает ошибку, можете подсказать  
где я допустил ошибку выделил красным где выдает ошибку  
image|644x500

---

<div class="post-metadata">

**Author:** ![HeleneB](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/heleneb/32/2775_2.png) [@HeleneB](https://forum.katalon.com/u/HeleneB)\
**Post date:** [October 22, 2019, 8:05am UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/5 "2019-10-22T08:05:40Z")

</div>

Use english please

---

<div class="post-metadata">

**Author:** ![kesha\_shym](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kesha_shym/32/20464_2.png) [@kesha\_shym](https://forum.katalon.com/u/kesha_shym)\
**Post date:** [October 22, 2019, 8:11am UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/6 "2019-10-22T08:11:20Z")

</div>

Hi, I have a 13-speed case in my test  
Gives an error, you can tell  
Where I made a mistake highlighted in red

---

<div class="post-metadata">

**Author:** ![hpulsford](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hpulsford/32/2985_2.png) [@hpulsford](https://forum.katalon.com/u/hpulsford)\
**Post date:** [October 22, 2019, 8:26am UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/7 "2019-10-22T08:26:03Z")

</div>

Are both the IF and else IF statements true?

---

<div class="post-metadata">

**Author:** ![jpereyra](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jpereyra/32/16104_2.png) [@jpereyra](https://forum.katalon.com/u/jpereyra)\
**Post date:** [October 22, 2019, 8:23pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/8 "2019-10-22T20:23:38Z")

</div>

Hi @hpulsford,

Yes, it is IF - else IF

```auto
if (WebUI.verifyElementChecked(findTestObject('Object Repository/Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form8'), 
    0)) {
    WebUI.uncheck(findTestObject('Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form8'))

    WebUI.check(findTestObject('Object Repository/Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form13'))

    WebUI.click(findTestObject('Page_Personalized Clocks Insider/input_West Coast N America_op'))

    WebUI.verifyElementPresent(findTestObject('Object Repository/Page_Home page Insider/span_West Coast N America'), 0)

    WebUI.verifyElementVisible(findTestObject('Page_Home page Insider/span_West Coast N America'))

    WebUI.closeBrowser()
} else if (WebUI.verifyElementChecked(findTestObject('Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form13'), 
    0)) {
    WebUI.uncheck(findTestObject('Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form13'))

    WebUI.check(findTestObject('Page_Personalized Clocks Insider/input_Update this item_taxonomy_term_bulk_form8'))

    WebUI.click(findTestObject('Page_Personalized Clocks Insider/input_West Coast N America_op'))

    WebUI.verifyElementPresent(findTestObject('Object Repository/Page_Home page Insider/span_East Coast N America'), 0)

    WebUI.verifyElementVisible(findTestObject('Page_Home page Insider/span_East Coast N America'))

    WebUI.closeBrowser()
}

```

Thanks,  
Ruben B

---

<div class="post-metadata">

**Author:** ![hpulsford](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hpulsford/32/2985_2.png) [@hpulsford](https://forum.katalon.com/u/hpulsford)\
**Post date:** [October 23, 2019, 8:05am UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/9 "2019-10-23T08:05:45Z")

</div>

For the first IF statement, set the Failure handling to Optional. If its set to optional it will not show the test overall as failed, just show a warning for the step that did fail.

> **[Failure Handling](https://docs.katalon.com/katalon-studio/docs/failure-handling.html)**
>
> Failure handling settings allow users to decide whether Katalon Studio will continue running or not in case of errors occurs during execution. Currently, Katalon Studio supports the following failure handling...

---

<div class="post-metadata">

**Author:** ![jpereyra](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jpereyra/32/16104_2.png) [@jpereyra](https://forum.katalon.com/u/jpereyra)\
**Post date:** [October 23, 2019, 3:48pm UTC](https://forum.katalon.com/t/script-failing-in-overall-status/34934/10 "2019-10-23T15:48:45Z")

</div>

Hi @hpulsford,

Thanks for the info, but it seems to be only a workaround. I was wondering if anything is not correct in my code that is causing that failure.

Thanks,  
Ruben B
