Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

What part do Virtual Users play in a .NET test class and why do they have to be unique?

What part do Virtual Users play in a .NET test class and why do they have to be unique?

When a user has installed the SilkPerformer ".NET Add-In" and completed the Silk Performer Project Wizard to create a sample test driver for testing a .NET application, the first thing they will notice is that the generated test class is named "VUser". This "VUser" test class will become a UserGroup in the generated BDL script (which the test class plugs into at runtime during replay in SilkPerformer).

The VUser class is a public .NET class with the SilkPerformer.VirtualUser attribute applied. This attribute tells the .NET Add-In to generate a virtual user definition in the BDL script. The virtual user attribute has one parameter - the name of the virtual user that is to be generated in the BDL script when running a Try Script from within Visual Studio.

Below is a snippet of code providing an example of .NET test classes which have generated multiple virtual users in a Silk Performer BDL script:

 

CSharp Code BDL Script

[VirtualUser("Vuser1")]
public class
 MyTestUser1
{
...
}
[VirtualUser("Vuser2")]
public class
 MyTestUser2
{
...
}

BDL Script

dcluseruser
    Vuser1

   
user
    Vuser2

 

You can have multiple virtual user classes in your .NET assembly however the names must be unique, as the replay engine will always check for duplicate virtual user names and flag an error in the Task List.

The virtual user name will also be used as a prefix for all transactions and methods scripted in BDL to prevent method name duplication, since the same method name may exist in two different .NET classes.

Further information on SilkPerformer .NET Frameworks can be found in

START | ALL PROGRAMS | SILK | SILKPERFORMER x.x |DOCUMENTATION |.NET TESTING | .NET Framework Developer Guide

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 18:48
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.