Import and create a .NET Assembly API test step

Relevant for: API testing only

This topic describes how to import and create a .NET Assembly API test step.

Prerequisite

Prepare a .dll assembly file and store it in an accessible location.

Back to top

Import a .NET assembly

  1. In the toolbar, click the Import .NET Assembly button .

  2. In the Import .NET Assembly dialog box, select the .NET Assembly Browser tab.

  3. Navigate to the direction containing the assembly .dll or .exe file and select the file.

  4. Click Select to add it to the Selected References list.

  5. Click OK to add the .NET assemblies to the Toolbox pane.

Tip: After importing the .NET assembly, you should save the test. Not saving the test leads to unexpected behavior with the autocomplete functionality when adding an event handler to a .NET assembly test step.

Back to top

Select a GAC assembly - optional

Each computer where the common language runtime is installed has a machine-wide code cache called the GAC (Global Assembly Cache). The GAC stores assemblies specifically designated to be shared by several applications on the computer.

  1. In the Import .NET Assembly dialog box, select the GAC tab.

  2. In the list of references, select one or more GAC assemblies and click Select to add them to the Selected References list.

Back to top

Add an ExecuteEvent event handler

  1. In the Properties pane, open the Events tab

  2. In the ExecuteEvent row, in the Handler column, click the down arrow and select Create a default handler.

  3. In the TestUserCode.cs file that opens, locate the CodeActivity<#>_ExecuteEvent section of the code.

  4. Under the CodeActivity>#>_ExecuteEvent, edit the TODO area. You can access input and output properties that you defined earlier, using autocompletion.

    /// Use this.CodeActivity4 to access the CodeActivity4 Activity's context, including input and output properties.
    public void CodeActivity4_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
    {
    this.CodeActivity4.Input.Property1...
    ...
    }

Back to top

Add custom input and output properties - optional

By default, the .NET Assembly step contains no input or output properties. You must add the necessary properties:

  1. After adding a step, in the Properties pane, open the Input/Output Properties tab .

  2. In the Input/Output Properties tab, click the Add Input/Output Property button and add input and output properties.

Back to top