Manually creating a TransactionItem/QueueItem w/o an Orchestrator queue

I was just learning UiPath (the UiDemo practice example) and was playing with the nice test framework they created in the REF. One of the workflows (Process) I wanted to test required a TransactionItem(QueueItem) as an “in argument”. I didn’t want to have to use an Orchestrator queue just for this in my test harness workflow. I really only needed to start my app up, log into the app, and pass in a transaction before I called “Process”. I also wanted to create tests with different TransactionItem SpecificContent. I noticed there were some questions from other users about being able to create TransactionItems somewhat like this so I thought I would just post. UiPath pros can correct this as necessary.

In any case I did the following in my “Process” related test workflows:

  1. Created a empty queue item

  2. Invoked some code to add the SpecificContent dictionary and associated values. My values were being fed from variables I could change.

That was all I needed for my transaction and test workflow…

13 Likes

Hi,

What you are doing can be very useful to test the Process layer when it expects a queue Item as input.

Would be interesting to submit this to GO as a reusable component taking as argument a dictionary and returning a queue item.

Cheers

3 Likes

Thanks for the pointer. Once I get certified I’ll look into it. It sounds interesting.

My solution without code

5 Likes

Hello!
I got a Validation Error when initialise Dictionary: Cannot assign from type ‘System.Collections.Generic.Dictionary`2[System.String,System.Object]’ to type ‘UiPath.Core.QueueItem’ in Assign activity ‘Assign’.
Can anyone send an update what should I do?
Thanks in advance!

the prepared Dictionary has to be assigned on YourTransactionItemVar.SpecificContent Property

2 Likes

Thank You very much!
I just now released my inattention.

By putting the following in arguments tab as default value for transaction item:

New QueueItem With
{
    .SpecificContent = New Dictionary(Of String, Object) From
    {
        {"folderPath", "C:\Users\"},
        {"templateType", "locationChange"}
    }
}

you won’t need to add additional Assign or Invoke Code activities that you need to toggle on or off whenever you need QueueItem mocked.

Based on what’s described here: How to initialize objects by using an object initializer (C# Programming Guide)

3 Likes

May as well just do it in a one liner assigning (after initializing New QueueItem), this is how I am testing with “debug file” instead of “debug”, so I am not running the main.xaml just the workflow process.xaml, with my fake data (so it’s not consuming my queue):