How do to reuse ouput from one test case in another test case

Hello,
We have recently started using UiPath for test case automation. We have a test case that takes in test data via a test data queue. The specific workflow being tested creates a unique invoice number at the end of the workflow. We are capturing this unique invoice number but we would like to use it as an input to another test case. I couldn’t find a way to write it back to a column in the test data (using out argument etc.). Is there another way? What is the best practice for this scenario?

1 Like

@mj75

In the first test case, assign a value to the variable you created. This value should be the output you want to reuse.

In the first test case, you can create an argument to pass data to another test case
In the “Direction” column, select “Out” to indicate that the argument will be an output.

In the first test case, use the “Invoke Workflow” activity to call the second test case and pass the variable’s value as an argument.

Drag and drop an “Invoke Workflow” activity onto your workflow.

In the Properties panel, select the workflow file for the second test case.

In the “Arguments” section, assign the variable to the argument you created in the second test case

In the second test case, you can retrieve the output from the first test case using the argument you defined. This output will be available for use in the second test case.

Create a corresponding argument in the second test case with the same name and data type as the one defined in the first test case. Set its direction to “In” or “InOut” to indicate that it will receive data from the first test case.

Cheers…!

1 Like

I have worked on this with tes automation using using and there are a few ways to use the unique invoice number generated by one test case as an input to another test case

1. Use a global variable

You can create a global variable to store the unique invoice number. Then, you can access the global variable in the other test case and use it as an input.

2. Use a test data queue

You can write the unique invoice number to a test data queue and then read it from the queue in the other test case.

To write the unique invoice number to a test data queue, use the Add Test Data Queue Item activity. Set the Queue Name property to the name of the test data queue and set the Item property to the unique invoice number.

To read the unique invoice number from a test data queue, use the Get Test Data Queue Item activity. Set the Queue Name property to the name of the test data queue and set the Timeout property to a suitable value. The Item output variable will contain the unique invoice number.

Refer this doc for more details

https://docs.uipath.com/orchestrator/automation-cloud/latest/user-guide/managing-test-data-queues-in-studio

3. Use a database

You can store the unique invoice number in a database and then read it from the database in the other test case.

To store the unique invoice number in a database, use the Database activities. For example, you can use the Insert activity to insert the unique invoice number into a table.

To read the unique invoice number from a database, use the Database activities. For example, you can use the Select activity to select the unique invoice number from a table.

Best practice

The best practice for using the unique invoice number generated by one test case as an input to another test case depends on the specific scenario. However, in general, it is recommended to use a test data queue to store the unique invoice number and then read it from the queue in the other test case. This is because test data queues are a reliable and efficient way to store and share data between test cases.

Hope this clarifies

Cheers @mj75

1 Like

Thanks, Dilli. This sounds good but we have a scenario where the 2nd set of test cases will be run during a different time period (because we need backgound jobs on the applications to be completed). Therefore, we need to persist the output somewhere and use it as part of the test data.

Thanks, Palaniyappan. Writing back to the test queue is a good idea. I’ll try that out.

1 Like

Cool
Hope it’s clarified

If yes would recommend to close this topic

Cheers @mj75

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.