Best practices of automated tests

In order to create a better automation you might want to look for a good testing environment. And here’s the issue with the UiPath since it’s not very clear how to automatically test your workflows.

I don’t have a proper experience of creating the so called unit tests in programming and I never tested any programs in a proper way but the idea is clear - we want to write tests, successful finishing of which would make sure your robot most probably will not crash on another computer.

When I faced the ReFramework concept here I saw the test environment but the idea of using still remains unclear. All the workflows are put to the .xaml file and it will obviously lead to exceptions because if you need to test, say, return to the main page of an app you’ll have to have the app opened and run on another page.

So here are my questions which I already tried to ask here, with no replies at the end unfortunately:

  1. What would be mandatory to test in a UiPath project?
  2. What are best practices to create automated tests in the UiPath?
  3. Has anyone ever written their own tests? If anyone created their own tests I would be very grateful to look at them.

I have created tests, but cannot share them, but can share ideas. I don’t write test cases to test workflows (similar to unit test cases using JUnit), I write functional test cases which obv cover the workflow as well. If the functional testing is successful, should be good enough.


@skini76 Wow thank you for the answer, you’re the first person to address my comment about tests here.
Still remains unclear how you write functional tests. Could you please explain in more details? I’m not really familiar with it.

I understand that you’re unable to share your real tests but we might create a very simple application with one or two invokes and to write tests for this app if you have some time. I just want to have a minimal working example of it.


There is no rocket science, testing is nothing but input vs output. Maintain an excel for test data (input & output), pass this excel sheet as parameter, capture expected output & compare with the excel, update the excel for success/failure. In case of failure you can capture screen shots, write logs etc…


@skini76 yeah but this is legit only if you have functions that return something. What if I don’t have a function that returns a value? And also how can I compare expect output with the real one if the function works with the interface?


I have been doing TDD Workflow Development. Fan of TDD :slight_smile:

Basically, I would create a .NET project, in which I will be using Nunit Test Framework. And I create One class per Workflow containing several Test methods which would test the behavior of the workflow.

The first step for you get is the basics of Unit Testing using NUnit. It’s pretty simple.

@rajeev85 thank you very much for the comment. Could you please answer two more questions?

  1. What is the TDD (isn’t is something when you create a failed test and then try to turn from failed to success by creating a proper code)? What is the guarantee that the robot won’t crash if your tests are successful?
  2. Could you please share what exactly to start from in order to get acquainted with the NUnit and so on? For me, a lot of information on the internet look messy cause it’s difficult to get it together and sort it out :frowning:

TDD is something what you briefly said.

What is the guarantee that the robot won’t crash if your tests are successful?

It’s all in your hands and how effectively you write the tests and the coverage you achieve. You write the code either in C# or VB.NET and invoke the XAML file with appropriate arguments and assert the results.

There are plenty of books online to start off with Unit Testing, urge you to grab one and study. If you want me to suggest then I would say go for The Art of Unit Testing by ROY OSHEROVE, a good place to start.

1 Like

There is a very nice and elegant hackathon submission that i found yesterday on the topic, recommend you to have a look on it if you are interested on the subject.

I believe this is from @krsma



@rajeev85, @Florent_Salendres, thank you very much, I’ll take a look at this

@Florent_Salendres Ye it is my submission. Thanks for mentioning it! I already see a way to improve it by using your submission :smile:

I tried to make this framework as intuitive to use as possible, but if anyone got some questions, I am happy to help.


My experience with TDD is not good, in spite of 100% coverage, too many bugs during the functional testing, because the test cases are written by developers ie testing your own code. So I gave up TDD and same time/energy is spent on functional testing 7 results are much better. In addition the functional testing is automated using UiPath. Sorry to say, but I am not a fan of TDD/BDD etc…

Testing functionalites must be availbe out of the box from uipath. It’s no solution to test all process manually.

Hi @Stephu,

How would you see this out of the box worklfow testing functionality from UiPath?
Do you see it only for unit testing or do you see it also for integration/end-to-end testing?

Thank you,

Hi @rajeev85,

Your idea is very interesting!

Could you please describe how do you cope with situations when the worklfow that is being tested requires a certain state of the robot environment? For example having applications A,B and C opened and in certain states.

Thank you,

Hi Bogdan, @Bogdan_Popescu

My goal is do TDD, so the automated tests that I write are aimed at verifying the logic or behaviour of a workflow. I don’t go over the UI, just mock out UI activities like Attach browser or Open browser…etc.,

To ensure the workflow puts the right stuff on the screen, I have to look and visually verify.

Now you may say that for an automation the interactions almost or always happen at the surface level, I completely agree. But IO devices are out at the boundaries, physical layer cannot have automated tests. So I don’t have the need for applications opened in certain state. Hope I’m clear.

Hi @rajeev85,

How do you manage to mock UI activities?
Are your unit tests being ran automatically on a test environment or do you run them manually?

Thank you,

1 Like

Hi @Bogdan_Popescu,

I’ll try to get you a sample, hope i’ll get some free time this weekend.

Hi @Bogdan_Popescu
For starting it would help to have activities like arrange (to fill data) and assert(to check data). I also need an enviroment to start test. Like I do this inside visual studio with unit tests.

I would be nice that I can start test automatic inside my “build”-pipe line. I know there is not a build but think about CI/CD…

Is something planned from uipath for better testing possibilites?