groovy.lang.MissingPropertyException

@kazurayam

Check this sorry:

I looked at Velocify (2).zip

When I executed the test1, I saw an Exception:

Reason:
groovy.lang.MissingPropertyException: No such property: email for class: Script1606987724779
	at test1.run(test1:60)
...

This Exception is thrown at the line #60 of test1 script:

WebUI.verifyElementText(findTestObject('Object Repository/Page_Sales Funnel - TexasLending.com/input_Email Address_email'),	
    email.get(0))

The cause is quite obvious. In the test1 script, you do not have a variable email defined.

I have no more words to say. I do not know what you meant by email.get(0).

1 Like

@kazurayam I want to see if katalon input the specific email from keyword and then I want to get to verify.
I am newbie here so if you can help me will be more than nice:)

Note: I have not downloaded your code. I am looking at the code you placed in your posts above.

The email package and class do not appear to be imported into your test case. And I’m not sure what the hierarchy/structure is either, but you need something like this in your test case:

import email

In my code, I make my keywords static, which means I don’t need to say @Keyword and the methods are available to use like a global method:

Test Case

import static email

email package:

public class email {
	static def populateEmail(){

		String myEmailAddress = "test" + System.nanoTime() + "@itest.com";
		return myEmailAddress;
	}
}

But that still doesn’t explain what email.get(0) is meant to do. I don’t see a list/array called email anywhere.

1 Like

@Russ_Thomas
I was found in another post where use get(0)) to return the input value and I was thinking maybe I can use the same method to get the specific email inputted, how I said I want to verify if this email is inputted.
And thank you for the code

@costea.georgian89

I modified your original project. Now it runs fine.

Velocify 2.zip (122.2 KB)

The most notable part for you would be this portion in the Test Case test1:


def address = CustomKeywords.'com.costea.EmailUtil.getMyAddress'() 
WebUI.setText(findTestObject('Page_Sales Funnel - TexasLending.com/input_Email Address_email'), address)

//WebUI.verifyElementText(findTestObject('Page_Sales Funnel - TexasLending.com/input_Email Address_email'),
//    email.get(0)) 
def v = WebUI.getAttribute(findTestObject('Page_Sales Funnel - TexasLending.com/input_Email Address_email'),
        'value')
def result = WebUI.verifyEqual(v, address)
if (result) {
	WebUI.comment("Good! The address ${address} is what I expected")	
} else {
	WebUI.comment("Nein, die Adresse ${address} ist nicht das, was ich erwartet habe")
}

You should use WebUI.getAttribute(testobject, 'value') in order to retrieve the value out of the <input value="..."> tag.
WebUI.verifyElementText() does not work to retrieve and verify the @value attribute of <input>.

Why?

You should be aware, HTML <input value="foo"> tag contains the text("foo") you put as @value attribute. It does not look like <input>foo<input>. See some resources about HTML, like this

2 Likes

@kazurayam Thank you very much!

@kazurayam One more request if is possible.

If the else function is the returned one can I do something to fail and send the report like when a test step from a test case fails? I am not sure if you understand what I mean.
Like:

Thank you in advance!

You want to make the test to fail?
You can control it using KeywordUtil

For example

import com.kms.katalon.core.util.KeywordUtil

if (result) {
    ....
} else {
    ....
    KeywordUtil.markFailedAndStop("Nein, die Adresse ${address} ist nicht das, was ich erwartet habe")
}
1 Like

@kazurayam
Thank you very much!! You are the best!!

Code:
import static org.assertj.core.api.Assertions.*
import org.openqa.selenium.Keys as Keys
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webservice.verification.WSResponseManager
import groovy.json.JsonSlurper
import internal.GlobalVariable as GlobalVariable
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

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()

ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()

Issue:
2021-02-08 12:20:22.184 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2021-02-08 12:20:22.191 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Download API
2021-02-08 12:20:25.144 DEBUG testcase.Download API - 1: sendRequest(com)
2021-02-08 12:20:25.174 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/Download API FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: content for class: Script1612768471696
at Download API.run(Download API:20)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1612768816954.run(TempTestCase1612768816954.groovy:25)

2021-02-08 12:20:25.214 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Download API

Now same issue occurs, I’ve added all required Import statements as well…

Hi, Hope you doing Great.
I’m Finding the same issue incase of hitting Dropbox download API:

Code:
import static org.assertj.core.api.Assertions.*
import org.openqa.selenium.Keys as Keys
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webservice.verification.WSResponseManager
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import groovy.json.JsonSlurper
import internal.GlobalVariable as GlobalVariable

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()

ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()

Issues:
2021-02-08 12:20:22.184 INFO c.k.katalon.core.main.TestCaseExecutor - --------------------
2021-02-08 12:20:22.191 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Download API
2021-02-08 12:20:25.144 DEBUG testcase.Download API - 1: sendRequest(com)
2021-02-08 12:20:25.174 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: Test Cases/Download API FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: content for class: Script1612768471696
at Download API.run(Download API:20)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1612768816954.run(TempTestCase1612768816954.groovy:25)

2021-02-08 12:20:25.214 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/Download API

Kindly help me please

The message is telling you the reason. Your code is wrong.

Possibly your test case code has a line containing a word

      content

, which is somehow wrong. You can check your code more for yourself, can’t you?

=============== ROOT CAUSE =====================

For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html

03-17-2021 08:32:47 AM Test Cases/ExecuteAutomation

Elapsed time: 3.227s

Test Cases/ExecuteAutomation FAILED.
Reason:
groovy.lang.MissingPropertyException: No such property: CucumberEARunner for class: Script1615888833419
at ExecuteAutomation.run(ExecuteAutomation:20)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:398)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:389)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:368)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:360)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:255)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1615966361979.run(TempTestCase1615966361979.groovy:25)

Please help me resolve this error.

Please share the source code of this test case.

1 Like


package com.ea.steps

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 static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.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
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import cucumber.api.junit.Cucumber;
import internal.GlobalVariable
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(features = “Include/features”,
glue=[“”],
tags=[“@FunctionalTests”],
plugin = [“pretty”, “html:ReportsFolder/cucumber.json”])

public class CucumberEARunner {
}

In the test case, you need a line:

import com.ea.steps.CucumberEARunner
1 Like

Thank you ! That really helped me !

I have one more question :slight_smile: How can I change this root ? This is not the one from my computer
Original error: The application at ‘C:\Users\majdag.RYARC\Downloads\app-release (4).apk’ does not exist or is not accessible

I don’t understand what you mean.

1 Like