Error : Change Password

Error :

file:/Users/naveen/git/adwiser/test/src/katalonstudiotest/testframework/Scripts/biz_password/Script1539321679627.groovy: 33: unable to resolve class TestObjectProperty

@ line 33, column 22.

TestObjectProperty objectone = new testObjectProperty(“Authorization”,ConditionType.EQUALS, basicAuth)

                    ^

file:/Users/naveen/git/adwiser/test/src/katalonstudiotest/testframework/Scripts/biz_password/Script1539321679627.groovy: 33: unable to resolve class testObjectProperty

@ line 33, column 34.

TestObjectProperty objectone = new testObjectProperty(“Authorization”,ConditionType.EQUALS, basicAuth)

                                ^

file:/Users/naveen/git/adwiser/test/src/katalonstudiotest/testframework/Scripts/biz_password/Script1539321679627.groovy: 49: unable to resolve class TestObjectProperty

@ line 49, column 22.

TestObjectProperty token = new testObjectProperty(“Authorization”,ConditionType.EQUALS, response.responseBodyContent.value.toString())

                    ^

file:/Users/naveen/git/adwiser/test/src/katalonstudiotest/testframework/Scripts/biz_password/Script1539321679627.groovy: 49: unable to resolve class testObjectProperty

@ line 49, column 30.

TestObjectProperty token = new testObjectProperty(“Authorization”,ConditionType.EQUALS, response.responseBodyContent.value.toString())

                            ^

file:/Users/naveen/git/adwiser/test/src/katalonstudiotest/testframework/Scripts/biz_password/Script1539321679627.groovy: 53: unable to resolve class HttpTextBodyContent

@ line 53, column 33.

changePassword.setBodyContent(new HttpTextBodyContent(‘bmV3UGEkJHcwcmQ=’, ‘UTF-8’, ‘text/plain’))

                               ^

5 errors

CODE/SCRIPT for CHANGE PASSWORD

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 java.util.concurrent.locks.Condition

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.ConditionType

import com.kms.katalon.core.testobject.RequestObject

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 groovy.json.JsonOutput

import internal.GlobalVariable as GlobalVariable

def requestObject = (RequestObject)findTestObject(‘Biz_Auth’)

def changePassword = (findTestObject(‘biz_password’) as RequestObject)

def advInputData = findTestData(‘Adv_Input_Data’)

try {

def usrPwd = ‘coffeeday’ + ‘:’ + ‘Pa$$w0rd’

String basicAuth = 'Basic ’ + usrPwd.bytes.encodeBase64().toString()

TestObjectProperty objectone = new testObjectProperty(“Authorization”,ConditionType.EQUALS, basicAuth)

ArrayList defaultHeaders = Arrays.asList(objectone)

def resetPassword = WS.sendRequest(changePassword)

requestObject.setRestUrl(“http://localhost:8080/adwiser/siva/cm/adv/auth”)

requestObject.setRestRequestMethod(“POST”)

requestObject.setHttpHeaderProperties(defaultHeaders)

def response = WS.sendRequest(requestObject)

WS.verifyResponseStatusCode(resetPassword, 200, FailureHandling.STOP_ON_FAILURE)

TestObjectProperty token = new testObjectProperty(“Authorization”,ConditionType.EQUALS, response.responseBodyContent.value.toString())

ArrayList passwordHeaders = Arrays.asList(token)

changePassword.setBodyContent(new HttpTextBodyContent(‘bmV3UGEkJHcwcmQ=’, ‘UTF-8’, ‘text/plain’))

changePassword.setRestUrl(“http://localhost:8080/adwiser/siva/cm/adv/pwd”)

changePassword.setRestRequestMethod(“POST”)

changePassword.setHttpHeaderProperties(passwordHeaders)

def passwordResponse = WS.sendRequest(changePassword)

WS.verifyResponseStatusCode(passwordResponse, 200, FailureHandling.STOP_ON_FAILURE)

}

catch (Exception ex) {

println(ex.detailMessage)

}

Screen Shot 2018-10-16 at 12.27.18 PM.png

Can you please anyone help out, why im getting this error ? and can someone help out why this is happening in this code?

New to Testing. I have no clue on it

import com.kms.katalon.core.testobject.TestObjectProperty

Tip: I always use the Right mouse button click in the Script view to select “Source/Organize Imports (Ctrl+Shift+O)” to resolve any missing Import statements in the script.

image.png

Thanks for the info. That error has been resolved.but got another error like 415 Response code error, seems ive mentioned media type in my script correct only.

please help me in this too as well.

Screen Shot 2018-10-16 at 3.35.01 PM.png


please post log as text formatted as code so we can read it

btw. don’t use detailedMessage, use ex.getMessage() this is getter for that string
https://www.tutorialspoint.com/groovy/groovy_exception_handling.htm

2018-10-16_12-17-17.png

Thanks for the help I have Resolved the issues, I forget to add header type in my script. Now it is working good,

Thank you guys for your help