Using Test_Framework and Test mode parameter's examples?

Any examples, tutorials on using test mode parameter’s and/or using the Test_Framework?

Thanks!

The testing feature of the ReFramework makes it a bit easier to do automatic testing of workflows. Instead of testing them one by one and checking the results manually, you can specify the predicted outcome of a workflow (e.g., successful execution, BusinessRuleException in case of invalid data, application exception if some application isn’t available) and see whether the actual results matched your expected results.

Before doing that, note that the way to test workflows is very important. For example, suppose you have a workflow called Sum.xaml, which receives two input arguments, Number1 and Number2, and returns the sum, Result, as output argument.
One common approach is to use default values for arguments and manually change them depending on the case to be tested. I wouldn’t recommend this way, since it’s common to see developers forgetting about these default values and then having problems with their workflows (that usually don’t throw errors, but give the incorrect results).

Another way to do it is to create a separate workflow to test Sum.xaml. The ReFramework includes a test workflow template called _Test.xaml, which invokes InitAllSettings.xaml, since sometimes we need some information from Config (e.g., URL for a particular system or asset name). Based on this, we can create a Sum_Test.xaml, which invokes Sum.xaml and passes different arguments to it, depending on what you want to test.

Using this method, suppose we created three test cases for Sum.xaml: Sum_EmptyInput_Test.xaml, Sum_WrongResult_Test.xaml and Sum_Sucess_Test.xaml. To automate their use with the testing feature of the ReFramework, we first add their names to the Tests sheet of the _Tests.xlsx file (located in the Test_Framework folder), along with the expected result for those tests. For example, it is expected that Sum_Sucess_Test.xaml returns Success, but, depending on the implementation, Sum_EmptyInput_Test.xaml and Sum_WrongResult_Test.xaml might return BRE (BussinessRuleException).

After that, run the workflow RunAllTests.xaml (also in the folder Test_Framework) to execute the listed workflows. The test results will be in the Result sheet of _Tests.xlsx. In addition, the file TestLog.txt will be open, showing the logs for the execution of tests.

A very important detail is that the tests will be executed according to the order specified in _Tests.xlsx. This is relevant when, for example, you want to test the interaction with a particular software, but the workflow to open the software (like InitAllApplications.xaml) isn’t executed before that. This will probably give you an AppEx (ApplicationException) due to something like a selector not found.
Also, if you want to test the same workflow multiple times, you need to specify it on the Excel file multiple times. This part got improved by the Enhanced ReFramework, as you can specify the number of times to run a particular workflow.

For a practical example, take a look at this sample project: ReFrameworkTestFeature.zip (556.0 KB)

All in all, I’d say that the testing feature of the ReFramework helps automating tests of workflows, but the most important (and difficult!) part remains the creation of good tests cases for your particular situation. For that, creativity and experience go a long way!

16 Likes

Thanks so much @Mateus_Cruz! So IYHO would you deem using the test feature within the framework unit or functional testing?

Also, any eta on when the EnhancedReFramework will be considered “live” or is it the same one that’s currently published on the GO! site?
Cheers :metal:

I’d say it depends on the project and the developers. If people are already comfortable and efficient using something else, then just stick with that.
If not, then try introducing the test feature of the ReFramework and get some feedback.

The Enhanced ReFramework is already “live”, but only available on the marketplace. If you want it like a button on UiPath Studio, with Studio 2018.4, you can save it as a template and have it there for easier access:

2 Likes

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