Start a new topic

[SOLVED] How do you return a value with a Custom Scripted Action in C#?

I can see how to define arguments, but how do you define the return value?

Help on Scripted Actions:


Okay I figured it out. You have to do the following:

  1. Inside the TAVS Test you need to use the 'set variable' action to create a variable
  2. Pass the name of the variable you created into the Custom Scripted Action
  3. Inside the C# code call AbtLibrary.Assign() to set the value to the variable.

Here is some example code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LogiGear.TestArchitect.VisualStudio.Automation;

namespace TA_CustomActions_POC_US_56832
    class RachelsTests
        /// <summary>
        /// This is an example custom action for Rachel. The idea is she can cut and paste this to
        /// make additional custom actions. This action takes 2 strings, puts them together and pushes
        /// that new value to the specified return Variable
        /// </summary>
        /// <param name="stringData1">A string of data to add to stringData2</param>
        /// <param name="stringData2">A string of data to add to stringData1</param>
        /// <param name="returnVariable">This is the string representation of the variable that will
        /// hold the return value of the action.</param>
        public void vcs_vNext_Rachel_Example(string stringData1, string stringData2, string returnVariable)
            string tempData = stringData1 + stringData2;
            // This method assigns a value to specified variable.
            AbtLibrary.Assign(returnVariable, tempData);

Login or Signup to post a comment