How to pass arguments to a test from the UIPath CLI

I am trying to pass arguments to a test set using the UiPath CLI. It took some effort to get the correct format for the JSON as the CLI kept complaining that I had it wrong. I eventually landed on:

    "name": "ENVIRONMENT",
    "value": "",
    "type": "String"

this doesn’t throw any errors however once the tests start they fail almost immediately and the results show no input arguments:

<testcase assertions="0" classname="My.Test.Test" name="Test.xaml" status="Failed" time="0.197">
      <error message="A fault occurred while executing job 198714642 for Test.xaml." type="Fault" />
      <system-out>Test case Test.xaml (v1.0.131382808-alpha) executed as job 198714642 and took 
           InputArguments {} OutputArguments {}

The command I’m running is the following, using the UiPath CLI Devops Script:

- zz.\scripts\uipcli.ps1 test run "" ${UIPATH_TENANT_NAME} -A ${UIPATH_ACCOUNT_NAME} -I ${UIPATH_APPLICATION_ID} -S ${UIPATH_APPLICATION_SECRET} -o ${UIPATH_FOLDER} -P "path\to\project.json" -i ${UIPATH_INPUT_PATH} --applicationScope "OR.Monitoring OR.Folders OR.BackgroundTasks OR.TestSets OR.TestSetExecutions OR.TestSetSchedules OR.Settings OR.Robots OR.Machines OR.Execution OR.Assets OR.Users OR.Jobs" -r ./result.json

The ‘-i’ argument is where I’m passing in a json that looks like the above block.

Appreciate any comments on where I may be going wrong,
thank you!

1 Like

Hi @cormac.williamson,

  • Check format of the JSON file you are passing as an input argument. If format you provided looks correct, so it’s possible that the issue is with how the JSON file is being read by the UiPath CLI.

  • Another thing to check is whether the argument name “ENVIRONMENT” is being used correctly in the test case. Make sure that the test case is using the same argument name “ENVIRONMENT” and that it is spelled exactly the same way (including capitalization). If the argument name in the test case is different or misspelled, it will not receive the value passed by the JSON file.