An Approach how to Implement Unit Tests in UiPath

For some time now I have been working on the topic of how unit tests can be implemented in UiPath. Unit tests are very important elements in automation for me. In my case I want to realize manual executed black-box tests, to ensure that my automations deliver the expected result. I look at this from the perspective of an RPA developer who is in the development process.

Here an example: I have a Main process which invokes an SAP BAPI call. Here I add an empty sequence.

image

In the next step I rename the sequence activity to Unit Test and a name that is as self-explanatory as possible.

image

Now I extract the empty sequence as a workflow. The call to the workflow in the main routine is deleted so that the unit test exists independently in the project.

image

image

In this extracted workflow I add the module under test. Also I add a few verify with operator activities from the UiPath Testing Package. With this I created an image of the call from the main routine.

The import arguments are fixed and the export arguments are verified.

image

image

The advantage of this approach is that this kind of unit tests can be repeated at any time with the same inputs and the same expected outputs. They are part of the automation workflow, but independent of it, because they can only be called manually. The implementing of unit tests promotes the modularization of the automation workflows. A test-driven development can be realized on this way in the Studio.

Even though this approach seems a bit cumbersome and a bit handmade, it does the job and gives me as an RPA developer reliability in the automation workflows I create.

4 Likes