Chandrasekaran Ganapathy said:
Can we return multiple variables from one test case
I have the same issue. Have u deal with it?
Chandrasekaran Ganapathy said:
Can we return multiple variables from one test case
I have the same issue. Have u deal with it?
Phan Ky Giang said:
Chandrasekaran Ganapathy said:
Can we return multiple variables from one test case
I have the same issue. Have u deal with it?
I think the easiest way to do that is a variable of type array, or map or similar. You can about arrays et al here:
http://docs.groovy-lang.org/latest/html/documentation/#_arrays
Phan Ky Giang said:
Chandrasekaran Ganapathy said:
Can we return multiple variables from one test case
I have the same issue. Have u deal with it?
Yes⌠You can create a HashMap and return the mapâŚ
Test Case :1
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
WebUI.openBrowser(ââ)
WebUI.navigateToUrl(GlobalVariable.URL)
WebUI.click(findTestObject(âReset Wishlist/Page_Your store/a_Log inâ))
WebUI.setText(findTestObject(âReset Wishlist/Page_Your store. Login/input_Email_Emailâ), âjohndeo@gmail.comâ)
WebUI.setEncryptedText(findTestObject(âReset Wishlist/Page_Your store. Login/input_Password_Passwordâ), âaeHFOx8jV/A=â)
WebUI.click(findTestObject(âReset Wishlist/Page_Your store. Login/input_Forgot password_button-1â))
WebUI.click(findTestObject(âReset Wishlist/Page_Your store/span_Wishlistâ))
if (WebUI.verifyElementPresent(findTestObject(âReset Wishlist/Page_Your store. Wishlist/input_245.00_updatecartâ),
5, FailureHandling.OPTIONAL) == true) {
while (WebUI.verifyElementPresent(findTestObject(âReset Wishlist/Page_Your store. Wishlist/input_Remove_removefromcartâ),
5, FailureHandling.OPTIONAL) == true) {
WebUI.click(findTestObject(âReset Wishlist/Page_Your store. Wishlist/input_Remove_removefromcartâ))
WebUI.click(findTestObject('Reset Wishlist/Page\_Your store. Wishlist/input\_245.00_updatecart'))
}
WebUI.verifyTextPresent('The wishlist is empty!', false)
WebUI.navigateToUrl(GlobalVariable.URL)
} else {
WebUI.navigateToUrl(GlobalVariable.URL)
}
WebUI.closeBrowser()
Test case :2
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
WebUI.callTestCase(findTestCase(âReset Wishlistâ), [(GlobalVariable.Password) : GlobalVariable.Password, (GlobalVariable.Username) : GlobalVariable.Username],
FailureHandling.STOP_ON_FAILURE)
WebUI.click(findTestObject(âReset Wishlist/Page_Your store/input_245.00_button-2 add-to-wâ))
WebUI.click(findTestObject(âReset Wishlist/Page_Your store/a_wishlistâ))
WebUI.verifyElementText(findTestObject(âReset Wishlist/Page_Your store. Wishlist/a_HTC One M8 Android L 5.0 Lolâ), âHTC One M8 Android L 5.0 Lollipopâ)
can anyone help me out how can i map with this methods of test case 1 into the test case-2 , so i can call test case 1 in test case 2
Nope, this is not working for me
I initialize my global variable like this:
Thatâs how they work. Your initial value is re-assigned at the start of each test case. If you think about it, how else could it work? Re-assign the value you used last week?
I handle this by reading my globals from an external file. If I need to share the same value between tests, I use callTestCase - usually that means I donât need a global since a Test Case can return a value (which might be a Map of values).
https://docs.katalon.com/katalon-studio/docs/call-test-case.html
Thanks a lot for the response, I could make my TC work.