Why does my test cases passes when it should not?

So I created a test case where I need to add new orders to the system. Each order has a patient and other important information. I add the patient to the order by entering the id number of the patient. Every patient should be loaded to the sistem first for this case to work.

The thing is that the TC passes even when I enter an id number that does not exist on the system. If this happens the system suggests you to pick another patients so a pop up loads with all the previously loaded patients. The thing is that the TC I created does not make this, so it should fail, but it does not.

This is the TC:


WebUI.setText(findTestObject(‘Page_Login/input_User Name_vUSERNAME’), ‘admin’)

WebUI.setEncryptedText(findTestObject(‘Page_Login/input_User Password_vUSERPASSWORD’), ‘hUKwJTbofgPU9eVlw/CnDQ==’)

WebUI.click(findTestObject(‘Page_Login/input_User Password_LOGIN’))

WebUI.click(findTestObject(‘Page_Inicio/a_Pre Analtica’))


WebUI.click(findTestObject(‘Page_Inicio/a_Carga de rdenes’))


WebUI.waitForElementVisible(findTestObject(‘Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’), 30)

WebElement elementCI = WebUiCommonHelper.findWebElement(findTestObject(‘Object Repository/Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’),


WebUI.executeJavaScript(‘arguments[0].value='472444441221'’, Arrays.asList(elementCI))

WebUI.sendKeys(findTestObject(‘Page_Ingreso Orden/input_Nmero de Documento_vPERSONADOCUMENTONUMERO’), Keys.chord(Keys.ENTER))

WebUI.waitForElementVisible(findTestObject(‘Page_Ingreso Orden/span_DatosUsuario’), 30)
//WebUI.click(findTestObject(‘Page_Ingreso Orden/input_Prueba Codigo_vPRUEBACODIGO’))


//WebUI.waitForElementNotVisible(findTestObject(‘Page_Ingreso Orden/div_PacienteTipo’), 30)
WebElement elementPrueba = WebUiCommonHelper.findWebElement(findTestObject(‘Page_Ingreso Orden/input_Prueba Codigo_vPRUEBACODIGO’),


WebUI.executeJavaScript(‘arguments[0].value='1'’, Arrays.asList(elementPrueba))

CustomKeywords.‘keywordPrueba.CustomFunction.clickUsingJS’(findTestObject(‘Page_Ingreso Orden/input_Prueba Descripcion_BTNBTNADDPRUEBA’),

WebUI.waitForElementNotVisible(findTestObject(‘Page_Ingreso Orden/div_PacienteTipo’), 30)

WebUI.waitForElementVisible(findTestObject(‘Page_Ingreso Orden/div_BoxConPruebas’), 30)


CustomKeywords.‘keywordPrueba.CustomFunction.clickUsingJS’(findTestObject(‘Page_Ingreso Orden/input_Extraccin Observacin_BTNENTER’),

//WebUI.waitForPageLoad(5, FailureHandling.STOP_ON_FAILURE)

I need to know when my test cases fail cause I am using katalon and jenkins and whenever the tc fails I need to send and email. I should send and email whenever the entered id number is not on the system but I cant because it passes
Any suggestions?

what you have to check first is the element id , are you sure it’s the right element ? is the page using dynamic id ?
next you can check that the element is not loaded ? maybe it’s hidden ?

First of all, thanks for the answer and the help you are trying to give me

Second of all, what to you mean by this: “what you have to check first is the element id , are you sure it’s the right element ? is the page using dynamic id ?” sorry but I am new to katalon and I do not understand you.

Third, if I am not wrong, my tc shouldn’t fail when it is trying to do this?:
WebUI.waitForElementVisible(findTestObject(‘Page_Ingreso Orden/span_DatosUsuario’), 30)
What you are saying is that maybe it appears but it is hidden?

  1. Open your object “Page_Ingreso Orden/span_DatosUsuari” and copy what you have in the selector editor

  2. open the webpage where this item should be present (manualy) without doing this

  1. click f12 , this will open the inspection window click on console

  2. put the text in this format $x(“what you copied”) and click enter to run the command

For example i have this in my Selector Editor :

in the console i will put $x(“//*[@id = ‘testcontrol’]”)

if the console returns nothing then the object is not present ,if it returns an id then the object is present and katalon will detect it

i mean the html code might be there but you can’t see it because of css or whatever but katalon detects it

So this is what I did:

  1. I checked if the id was the same and it was. It is the correct element I am trying to wait for
  2. I did every step that you told me to do and something appears when the id number of the patient exist and when it does no exists in the system.

My conclusion after this is that the test case is working correctly because even when the id number of the patient is incorrect, there is still something in the page, like you said. It is hidden.
So if I want my test to fail whenever the id number is incorrect I will have to do something else instead of waiting that element to appear o not. I do not know how I will do this but I will figure it out.

Thanks for the answer. This helped a lot. If you have any suggestions on how to solve this, I would appreciate it because I am 100% sure the test should fail in that case. A new pop up appears whenever the id number is wrong. Maybe I should check if that appears or not. Is there a way to check for this?