Test that lookup a table and give me corresponding data

Hi, I have an internal data file already containing 1 column with the States/provinces names and the other column is the abbreviation, I would like a test case or a function to input the State/province name and get the corresponding abbreviation in ouput…

1 Like

Stop… We are not a code on demand service…

If you want help, you need to show us what you’ve tried,…

… Or, I could take this on for you, but it will be a private thing that we should DM each other about. My rate is $50 USD/hour for any tasks like this… Let me know

You can also see if the below document assists you in tackling your issue:

@mwarren04011990 You should also put in the currency that you work in, as $50 CAN would leave you a lot shy as compared to $50 US or as compared to other countries that use the “$” currency symbol. :slight_smile:

Just looked it up and today it’s 35% exchange rate.1 USD = 1.34901 CAD Jan 25, 2024

1 Like

I tried to understand the databinding documents and the examples and nothing is making sense… instead I used the java map with a for loop that uses my internal data file… Sorry if thought I was asking for you to code my solution…

Please show us what you have tried, and we can steer you in the right direction… It sounds like you have something that already works…

1 Like

Here is a very quick idea that you could have as a Keyword that you could use. You basically feed the Keyword the Province you have and return the abbreviation you want.

Maybe like:
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

def String matchProvince(String strProvince) { 
    def data = findTestData("Data Files/Provinces");
    def maxRow = data.getRowNumbers();
    province = 1
    abbr = 2
    strAbbreviation  = ""

    for (int row = 1; row <= maxRow; row++) {
        if (data.getValue(province, row).toUpperCase() == strProvince.toUpperCase()) {
            strAbbreviation = data.getValue(abbr, row)
            break pizza;
    return strAbbreviation;