Run Test Case with an external data source


This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/docs/run-test-case-external-data.html

Where is the documentation for implementing data-driven testing on just the test case without using the test suite? It involved using the InternalData class and getRowNumbers() along with a for loop to interate through the data.

same doubt. Please provide information on data driven at test case level

Refer to this article to learn how to create a new Excel Test Data in Katalon Studio.

The link is broken. Please rectify asap. Thank you so much

Would be great if this link can be fixed. Trying to see how to access the values from excel sheet in the script.

I found this: https://dzone.com/articles/data-driven-testing-approach-with-katalon-studio

Specifically this part:

B. Execute From a Test Case
6. We can also implement Data-driven tests in a test case. Just create a new test case and switch to Script Mode. To iterate tests with multiple sets of data, we need to use FOR statement and call the test data objects. Copy and paste the below code:

import com.kms.katalon.core.testdata.InternalData
InternalData data = findTestData(“Demo_Account”)
for (def index : (0…data.getRowNumbers() - 1)) {
WebUI.openBrowser(’’)
WebUI.navigateToUrl(‘http://demoaut.katalon.com/profile.php’)
WebUI.setText(findTestObject(‘Page_Login/txt_UserName’), data.internallyGetValue(“demo_usn”, index))
WebUI.setText(findTestObject(‘Page_Login/txt_Password’), data.internallyGetValue(“demo_pwd”, index))
WebUI.click(findTestObject(‘Page_Login/btn_Login’))
WebUI.verifyElementPresent(findTestObject(‘Page_CuraHomepage/btn_MakeAppointment’), 0)
WebUI.closeBrowser()
}

======================================

The problem is that I can’t get the InternalData import to work, I always get this error:

RROR c.k.k.core.main.WSVerificationExecutor - ? Verification FAILED.
Reason:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WSVerification1567017130188: 19: unable to resolve class InternalData
@ line 19, column 14.
InternalData data = findTestData(“Demo_Account”)

I think this is related to not being able to find the internal katalon libraries, but I can’t find them to add them to the classpath.

WSVerificationExecutor?

WS means in Katalon Studio “Web Service”.

I guess that your Katalon Project was initialized with type “API/Web Service”, not type “Web”.

The type of project may relate to the classpath content.

How about recreate a new project with type of “Web” and try the same test case with data?

This article is very informative and inspiring; but has some minor faults in the sample codes. I made a github project where I rewrote the sample code so that it runs successfully.

Please run the test case “TC2_loopOverTestData”

How to add new column for Variable Binding?