Setting Up Silk Performer .NET Projects

  1. Click Start here on the Silk Performer workflow bar.
    Note: If another project is already open, choose File > New Project from the menu bar and confirm that you want to close your currently open project.
    The Workflow - Outline Project dialog box opens.
  2. In the Name text box, enter a name for your project.
  3. Enter an optional project description in Description.
  4. From the Type menu tree, select .NET > .NET Framework using Visual Studio .NET Add-On and click Next. The Workflow - Model Script dialog box opens.
  5. Select the .NET Language (C# or VB.NET) icon for the language you prefer and click OK. The Microsoft Visual Studio Silk Performer Project Wizard opens.
  6. Enter the name of the .NET Testclass in the Name of testclass text box. In the Silk Performer Project text box, enter the name of the project that you created earlier in Silk Performer.
  7. Click Finish.
The following in the files and code are generated in Microsoft Visual Studio:
  • Each generated Testclass becomes a VirtualUser in the BDL script.
  • The first transaction becomes the Init transaction in the BDL script.
  • Files that are generated by the Wizard (code files and Silk Performer project/BDL scripts) are listed on the Solution Explorer page.
  • Handler/clean-up code can be inserted in the stopException method.
  • Custom code for exception handling can be inserted in the testException method.
  • ETransactionType.TRANSTYPE_MAIN becomes the Main transaction in the BDL script.
  • ETransactionType.TRANSTYPE_END becomes the End transaction in the BDL script.

Sample Skeleton Code Generated by the Project Wizard (C#)

using System;
using Silk Performer;

namespace SPProject1
{
  [VirtualUser("VUser")]
  public class VUser
  {
    public VUser()
    {
    }

    [Transaction(ETransactionType.TRANSTYPE_INIT)]
    public void TInit()
    {
      /* You can add multiple TestAttribute attributes to each function defining parameters that can be accessed through Bdl.AttributeGet


      Example of testcode: (Access bdl function through the static functions of the Bdl class Bdl.MeasureStart(...);
      ...
      Bdl.MeasureStop(...);
      */
    }

    [Transaction(ETransactionType.TRANSTYPE_MAIN)]
    public void TMain()
    {
    }

    [Transaction(ETransactionType.TRANSTYPE_END)]
    public void TEnd()
    {
    }
  }
}

As you can see from the skeleton example above, there is a custom attribute called VirtualUser that can be applied to classes. This causes the Add-On's BDL Generation Engine to generate a virtual user definition. You can implement multiple classes that have the VirtualUser attribute applied. The VirtualUser attribute takes the name virtual user as a parameter.

The BDL Generation Engine then parses the methods of the Virtual User class for methods that have a Transaction attribute applied to them. The Transaction attribute takes as a first parameter the transaction type (Init, Main or End). You can only have one Init and one End transaction, but multiple Main transactions.

The Main transaction type takes a second parameter that indicates the number of times that the transaction is to be called during load tests (default: 1).