Automation of workflow for automated testing

What are your opinions on writing "production" code to facilitate testing? Specifically, the use case is this: we have a system with a multiple step workflow, where a few stages are done by humans. We are looking to build automated tests for this workflow (not unit tests-those already exist) but need something to stand-in for the human steps in the workflow. The easiest option, by far, is to write a bit of code in the application itself to do those steps when configured to do so-with plenty of safeguards that this won't run in production. Not only is this the easiest to implement but it will also be the lowest profile and lowest latency in moving entities through the workflow stages. Certainly, this is irregular, but is it terrible? Another option is to write and deploy a separate "agent" to do those steps, but of course, we then have to manage that agent and it is more complex to write. (We are not looking to test that part of the application at the moment.) Yet another option is to use some sort of workflow automation framework. This is probably the most complicated option, but it may have other use cases in automated testing. If so, do you all have recommendations?

May 8, 2025 - 22:51
 0

What are your opinions on writing "production" code to facilitate testing?

Specifically, the use case is this: we have a system with a multiple step workflow, where a few stages are done by humans.

We are looking to build automated tests for this workflow (not unit tests-those already exist) but need something to stand-in for the human steps in the workflow.

The easiest option, by far, is to write a bit of code in the application itself to do those steps when configured to do so-with plenty of safeguards that this won't run in production. Not only is this the easiest to implement but it will also be the lowest profile and lowest latency in moving entities through the workflow stages. Certainly, this is irregular, but is it terrible?

Another option is to write and deploy a separate "agent" to do those steps, but of course, we then have to manage that agent and it is more complex to write. (We are not looking to test that part of the application at the moment.)

Yet another option is to use some sort of workflow automation framework. This is probably the most complicated option, but it may have other use cases in automated testing. If so, do you all have recommendations?