Project compilation fails during publish when execution template invokes a testcase

Hi,

Execution templates that invoke testcases will not compile succesfully during a publish of the library. This creates unnecessary double logic since the execution templates often need the exact same logic as a testcase.

For example: I have a testcase for an activity X in application Y. Before that can be executed, i need to login into this application. For this login I have a login testcase in which I defined specific credentials for testing purposes. Now if I add a new testcase for activity X, I’d like to do this with an execution template that uses the same credentials as in the login testcase. In the current situation I have to duplicate the functionality that is already in the login testcase whereas I’d rather simply invoke the login testcase and be done.

Hi Edwin,
hope you are doing good.
Did you have a look at Execution Templates?
Through execution templates, you can wrap test cases at runtime to use your defined execution conditions for multiple scenarios. For example, instead of copying, pasting, and maintaining multiple test cases, you can create a single template that acts as a boilerplate to wrap the test cases at runtime.

Hi Thomas,

Yes, my point is that I want to be able to invoke a testcase from within my execution template (obviously not a testcase that is set to use this execution template).

Hi Edwin,

I tried to reproduce the mentioned behavior:

  1. I created a Test Automation project
  2. I created a Login Test case within this project
  3. I created an execution template invoking this login testcase
  4. I created another testcase based on this execution template

I was able to run and compile this project.

Could you share some more info on why this is failling in your case? (probably the project)

Hi Thomas,

The problem is, as far as I’ve encountered it, only with libraries.
Attached is a small demo library which shows the issue. Activity2_test.xaml is set to use the ExecutionTemplate, which in turn invokes Activity1_test.xaml. You can compile and run it just fine, but the compilation during a publish fails.

Hope this clears things up.

Invoke_test_in_executionTemplate.zip (5.4 KB)

Thomas,

I work with Edwin and can explain the issue and use cases.

In a library you have various test cases, with the execution template intended to be a wrapper around those test cases, often taking care of things like logging in to an application before the test and closing down an application afterwards. These work fine when invoking normal workflows. But ideally we would like to invoke our login test case in the execution template as the login test case gets the credentials we need to log in, otherwise we must duplicate this in the login test and the execution template.

I hope that clearly explains the use case.

As for why this happens. This is due to the way the library is compiled. When you compile any UiPath project not everything gets included right, for example the .screenshots folder is ignored and doesn’t make it to the nuget package.
Similarly in a library the Test Cases are ignored and not published into the nuget package that is created. The execution template (and other templates) however are and this is where the problem lies. It tries to publish the execution template but it relies on workflows that are not being included in the publish, resulting in compiler error.

The solution to this, in my opinion, would be to allow us to mark specific templates are ‘ignore from publish’ as we can already do for workflows and the compiler would then ignore it. We obviously wouldn’t always want to ignore templates from a publish as sometimes its desirable to disseminate templates via a library.

It would still need to work and be included when publishing test cases however of course.

I hope thats clear. I believe I understand the issue quite well on a technical level so feel free to ask for clarity on any parts you do not understand.

Hi everyone,

I think I understood the core problem:

Test cases created in library projects are not available when compiling a library.
The reason why we did this was with the intention that Test Cases within a library project have the purpose to test this specific library only and should not be shared when using the library.

Is there any reason why you dont use a sequence for login and just reuse this login sequence (1) within the execution template and (2) in a separate testcase?

Hi Thomas,

We are actually already doing that, we have a login sequence that needs the credentials as input arguments. The logic of retrieving credentials and invoking the login sequence is precisely the logic that we currently have duplicated in both the execution template and in the testcase. This duplication is what we’re looking to prevent.
Arguably we could extract the retrieval of the credentials to a private workflow and invoke this in both scenario’s, but still then we would have to change the invoke logic at 2 places if the login logic would ever change. Instead, if we can invoke the login testcase in the execution template, it will always keep working, no matter future changes.

Precisely. As Edwin points out, the Login workflow requires a username and password.
In the test case we grab a specific test asset and use that, infact we sometimes dynamically grab an asset based on the test data associated with that workflow.
This is great as we can integrate this into the execution template for testing our workflows, otherwise we need to also build this logic to grab an asset into the execution template.

This I agree with. I am requesting you also make the Execution template we can optionally include when compiling the library.
Sometimes we’d want it for a process using that library. Typically not. If you give us the control to exclude this from the compilation we can use the template as described.

Hello again,

I reproduced the scenario and thought about it for quite some time.
I dont feel comfortable if we add another task to add or remove an executiontemplate from publish just incorporate this scenario, which seems to be rather an edge case compared to the majority of our customers.

I would strongly suggest to extract the affected Test case into a workflow, use this workflow within your testcase as well within the execution template.

This would be from my point of view the right way to handle the situation.

Hope this does not cause too much inconvenience for you.

Can you explain what you think the main use case for customers is for execution templates which requires it to be compiled and included as part of the normal publish?

I’d argue its an edge case to need it to do that.
What scenarios is the Execution template useful outside of the library? I am not sure it even would work to be honest, I haven’t really tried, but I think you’d need a library, to reference another library to even start to use it and I’m not sure why you’d want that execution template from the other library…

Perhaps you can explain the use cases you see, I think ours is clear. We want to use it to handle things like logging in to an application and logging out for all the actions in the library. We want to use our login test case to stop us needed to duplicate that code, I see no point in making a separate workflow as you suggest, it would force us to make a private workflow to ensure its not published and generally clutter things up, if you are forced to not invoke test cases its better we just do the grabbing of the assets and then login actions directly in the execution template.