Tests were not executed on linuxe


#1

Hi Team.

I run the script on linux, but got following errors .

tail: test_prod.log: file truncated

Request sent successfully.

!SESSION 2018-08-10 07:14:51.864 -----------------------------------------------

eclipse.buildId=unknown

java.version=1.8.0_161

java.vendor=Oracle Corporation

BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US

Framework arguments: -propertiesFile=/home/atg/test_new/configure/console_prod.properties -runMode=console

Command-line arguments: -os linux -ws gtk -arch x86_64 -data config -propertiesFile=/home/atg/test_new/configure/console_prod.properties -runMode=console -consoleLog

!ENTRY org.eclipse.core.resources 2 10035 2018-08-10 07:14:54.344

!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified

136 2.4.7.xx-201611170128-e46 = ACTIVE

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/global/Constant.groovy: 22 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/ObjectOperation.groovy: 28 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/global/Constant.groovy: 22 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/ObjectOperation.groovy: 28 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/Operation.groovy: 24 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/Operation.groovy: 24 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/RequestAndResponseOperation.groovy: 22 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Test Listeners/TestListener.groovy: 20 Groovy:unable to resolve class internal.GlobalVariable

/%home%atg%test_new%auto-test%Beacon_Automation_Test.prj/Keywords/com/beacon/method/RequestAndResponseOperation.groovy: 22 Groovy:unable to resolve class internal.GlobalVariable

I’m not sure where is wrong.
Katalon version : 5.6.0.

Thanks.


#2

Can we see the code? It’s looking like an issue with your keyword. Might be how the class is setup.


#3

B L said:

Can we see the code? It’s looking like an issue with your keyword. Might be how the class is setup.

BTW, I renamed the project. And this script is able to be run on my windows machine and another certenOS. But after copy to the new machine it not running.

Just Upload the keyword file is ok ?
Seems not able to put groovy file at here.


#4

B L said:

Can we see the code? It’s looking like an issue with your keyword. Might be how the class is setup.

Hi BL,

Seems like the mine issue is same as the issue mentioned in this one:

I also use the GlobalVariable in the customer keywords file. .

But still no solutions find in that discussion.

Thanks.


#5

Yes you can copy and paste the keyword here. Do you have import internal.GlobalVariable in keyword? is any error thrown in script for keyword?


#6

B L said:

Yes you can copy and paste the keyword here. Do you have import internal.GlobalVariable in keyword? is any error thrown in script for keyword?

Hi BL,

Yes, I’ve imported the internal.GlobalVariable in keyword as well as the Test listeners.

Following is the code for listeners.

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

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

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

import com.kms.katalon.core.testobject.ResponseObject

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 com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import internal.GlobalVariable as GlobalVariable

import com.kms.katalon.core.annotation.BeforeTestCase

import com.kms.katalon.core.annotation.BeforeTestSuite

import com.kms.katalon.core.annotation.AfterTestCase

import com.kms.katalon.core.annotation.AfterTestSuite

import com.kms.katalon.core.context.TestCaseContext

import com.kms.katalon.core.context.TestSuiteContext

class TestListener {

/**

* Executes before every test case starts.

* @param testCaseContext related information of the executed test case.

*/

@BeforeTestCase

def sampleBeforeTestCase(TestCaseContext testCaseContext) {

println testCaseContext.getTestCaseId()

println testCaseContext.getTestCaseVariables()

Map veriables = testCaseContext.getTestCaseVariables()

def caseType = veriables.containsKey(“caseType”)

def caseTypeValue = veriables.containsValue(“API”)

if(caseTypeValue){

WebUI.comment("************API case, no need to open browser.")

}else{

WebUI.openBrowser(null)

try {

WebUI.maximizeWindow()

} catch (Exception e) {

e.printStackTrace()

}

}

}

/**

* Executes after every test case ends.

* @param testCaseContext related information of the executed test case.

*/

@AfterTestCase

def sampleAfterTestCase(TestCaseContext testCaseContext) {

println testCaseContext.getTestCaseId()

println testCaseContext.getTestCaseStatus()

Map veriables = testCaseContext.getTestCaseVariables()

def caseType = veriables.containsKey(“caseType”)

def caseTypeValue = veriables.containsValue(“API”)

if(GlobalVariable.G_RunningStatus)

{

if(testCaseContext.getTestCaseStatus() == “ERROR”)

{

GlobalVariable.G_RunningStatus = false

} else

{

println testCaseContext.getTestCaseId() + " = Pass ~"

}

if(caseTypeValue){

WebUI.comment("************API case, no need to close browser.")

RequestObject logoutReq= CustomKeywords.‘com.beacon.method.ObjectOperation.addHeaderCookieValueToRequest’(GlobalVariable.G_CookieValue,

findTestObject(‘Request/Hover Api/My Account/REST - Logout’, [(‘siteURL’) : GlobalVariable.G_SiteURL]))

ResponseObject response = WS.sendRequest(logoutReq)

def statusCode = response.getStatusCode()

if(statusCode == 200){

def responseText = response.getResponseText()

println responseText

if (responseText.contains(’“messageInfo”:“Logout successful”’)) {

WS.comment("****************Logout Successfully.")

assert true

} else {

WS.comment(’****** Response status code is 200, response text is: \n’ + responseText)

assert false : responseText

}

}

}else{

try {

String currentURL = WebUI.getUrl()

if(!currentURL.contains("/register"))

{

WebUI.navigateToUrl(GlobalVariable.G_SiteURL)

WebUI.waitForPageLoad(GlobalVariable.G_TimeOut)

WebUI.delay(GlobalVariable.G_WaitTime)

WebUI.callTestCase(findTestCase(‘Test Case/Header/Global/Logout From Site’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.comment("**********************Logout from Store.")

}else{

WebUI.comment("***************Alreay logged out.")

}

WebUI.comment("**************Close bowser.")

WebUI.closeBrowser()

} catch (TimeoutException e) {

e.printStackTrace()

}

}

} else

{

println "GlobalVariable.G_RunningStatus is false when execute " + testCaseContext.getTestCaseId()

}

}

}

Do to some reason, we need to logout from site after testing. So I need this kinds of Global Variables.


#7

B L said:

Yes you can copy and paste the keyword here. Do you have import internal.GlobalVariable in keyword? is any error thrown in script for keyword?

HI BL,
I’ve removed the imported global variables from my keywords.

But still get such kind of error when run scripts on Linux

!SESSION 2018-08-12 00:20:35.073 -----------------------------------------------

eclipse.buildId=unknown

java.version=1.8.0_161

java.vendor=Oracle Corporation

BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US

Framework arguments: -propertiesFile=/home/atg/test_new/configure/console_prod.properties -runMode=console

Command-line arguments: -os linux -ws gtk -arch x86_64 -data config -propertiesFile=/home/atg/test_new/configure/console_prod.properties -runMode=console -consoleLog

!ENTRY org.eclipse.core.resources 2 10035 2018-08-12 00:20:37.637

!MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes.

Starting Groovy-Eclipse compiler resolver. Specified compiler level: unspecified

136 2.4.7.xx-201611170128-e46 = ACTIVE

Any suggestions? Thanks a lot.


#8

B L said:

Yes you can copy and paste the keyword here. Do you have import internal.GlobalVariable in keyword? is any error thrown in script for keyword?

I found that when run katalon in linux, I got following errors

Test suite ‘Test Suites/Test Suite Collection/Prod/Prod_BVT’ not found.


#9

B L said:

Yes you can copy and paste the keyword here. Do you have import internal.GlobalVariable in keyword? is any error thrown in script for keyword?

Thanks BL, I’ve resolved the issue. thank a lot.


#10

Sorry for the delayed response this thread got buried on me :S I’m glad you resolved it though :slight_smile: