Question
Unit Testing RPA Without Dependence on Application
I'm working on setting up Continuous Integration and Delivery for RPA development and am wondering about best practices for unit testing RPA code. It would be best to not depend on the live application for a number of reasons:
- The unit test project might have to be deployed to a separate machine with an active user session in order to run it, rather than being run right on the build server.
- Test case data cannot be guaranteed not to change
- There's no way to guarantee that the application will not go into an unavailable state
- Running negative tests (such as wait-for-create timeouts) would either be impossible or make the unit test runs take a long time (as opposed to simulating timeouts without having to wait the full time)
The way I know to handle these scenarios is to use dependency injection and inject mocks for all the controls of the application, so that the RPA code doesn't know (and doesn't care) whether it has the real application (interrogations) or a fake one. This would have to be a custom, in-house build. However, I wanted to ask here to see if there is some built-in way to handle this, and if someone has experience with this before going ahead with that solution. Also, if we use custom code to achieve this kind of testability, would Pega refuse to support our RPA code?
If you are testing Pega Robotics code, then, fundamentally, what you are testing is the ability to interact with the applications. If you replace that with something else, then what really are you testing? If you limit the code in Pega Robotics to simply interacting with the application(s) and leave all logic to the Pega case, then you can test everything you are asking for without Pega Robotics (although you still need to test that part at some point). You could create a testing flag on your case and when the Robot Activity is fired, check this parameter and decide whether or not to perform any action against the applications, or to simply return any data you expect.