Looking for better way to run test case in different domain

Hi, I am looking for a better way to run my test case with different domain.
Currently, we have a common file that keeps all server, browser, rul information in one place, however, I would like to run the test case with url that is ending with .ca or .ca/fr as well for some of my test case. (Test case steps will be the same, only the url ending part changes (.com or .ca or .ca/fr)
Following code shows how we are able to run it now but there is a problem with this approach, because we are calling test setup in each test case and in test setup it is defined as the Go to Front Page, so the .com page opens up as default when Test Case- “Fill out .ca form Successfully” runs and then it replace the url to .ca.
I am not sure how I should solve this or if there is any other way that Robot Framework already offers.

*** Variable ***
${SERVER_ENV}= ${NONE}

${TOP_LEVEL_DOMAIN}= com
${SERVER}= ${SERVER_ENV}.abc.${TOP_LEVEL_DOMAIN}
${BROWSER}= Chrome
${REMOTE_URL}= ${NONE}
${DESIRED_CAPABILITIES}= ${NONE}
${ROOT}= https://${SERVER}
${FRONT_PAGE}= ${ROOT}/
${SPEED}=

*** Keyword ***
Go to .com Front Page
[Documentation] Goes to front page
Go To ${FRONT PAGE}

Go to .ca Front Page
[Documentation] Goes to Canada front page
${Canada front page} = Replace String ${FRONT PAGE} .${TOP_LEVEL_DOMAIN}/ .ca/
Go To ${Canada front page}

*** Test Cases ***
Fill out form Successfully
Given User navigate to the .com link

Fill out .ca form Successfully
Given User navigate to the .ca link

Any help will be really appreciated

Hi Parl,

You’re close already :+1: You’ve already structured your test variables well for what you want to acheive

Option 1
This is if you want to run all the exact same test cases for each domain and produce a separate report file for each domain

When you run robot you can pass variables in with the -v or --variable option (if you’re using a CI you’ll need to configure it to do that)

so if you currently run for .com

robot <your robot file>.robot

All you need to do is run like this for the other domains

robot -v TOP_LEVEL_DOMAIN:ca <your robot file>.robot
robot -v TOP_LEVEL_DOMAIN:fr <your robot file>.robot

Option 2
If you want to test all the sites in the same test suite and have one report

Then the best approach will probably be to use the BuiltIn Set Test Variable to update the necessary variables then you can keep most of your keywords the same like this:

*** Variable ***
${SERVER_ENV}    ${NONE}

${TOP_LEVEL_DOMAIN}    com
${SERVER}    ${SERVER_ENV}.abc.${TOP_LEVEL_DOMAIN}
${BROWSER}    Chrome
${REMOTE_URL}    ${NONE}
${DESIRED_CAPABILITIES}    ${NONE}
${ROOT}    https://${SERVER}
${FRONT_PAGE}    ${ROOT}/
${SPEED}

*** Keyword ***
Go to Front Page
	[Documentation] 	Goes to front page
	# Go To   ${FRONT PAGE}
	Log    ${FRONT PAGE}

*** Test Cases ***
Fill out form Successfully
	# Given User navigate to the .com link
	Go to Front Page

Fill out .ca form Successfully
	# Given User navigate to the .ca link
	Set Test Variable    $TOP_LEVEL_DOMAIN    ca
	Set Test Variable    $SERVER    ${SERVER_ENV}.abc.${TOP_LEVEL_DOMAIN}
	Set Test Variable    $ROOT    https://${SERVER}
	Set Test Variable    $FRONT_PAGE    ${ROOT}/
	Go to Front Page

Hope that helps,

Dave.