I have created some Load Tests
. All my load tests are consist of one unit test.
I have also created a LoadTest Plug-in
and assigned it to all my load tests.
Each unit test updates some custom performance counters that I create in the LoadTest Plug-in (more details here) with the following code.
PlugIn code:
private void m_loadTest_LoadTestStarting(object sender, System.EventArgs e)
{
CounterCreationDataCollection counters = new CounterCreationDataCollection();
counters.Add(new CounterCreationData("CustomCoumter", "Custom Coumter description", PerformanceCounterType.AverageCount64));
PerformanceCounterCategory.Create("CustomCounterCategory", "Custom Performance Counters", PerformanceCounterCategoryType.MultiInstance, counters);
}
UnitTest code:
[TestClass]
public class UnitTest1
{
PerformanceCounter customCounter;
[ClassInitialize]
public static void ClassInitialize(TestContext TestContext)
{
// Create the instances of the counters for the current test
customCounter= new PerformanceCounter("CustomCounterCategory", "CustomCoumter", "UnitTest1", false));
}
[TestMethod]
public void TestMethod1()
{
// ... Testing
customCounter.Incerement(time);
}
}
Since the plugin is running in the Test Controller
the custom counter category is created in the pc where the controller is running. Now I am running my Load Tests in a Test Rig
using many Test Agents
. When a unit test is executing in a pc other than this where the Test Controller is running the counter is not updated. I think this happens because with my code I am updating the counter in the pc where the test is running, NOT in the controller's pc.
How can I update my custom counter in the controller's pc? Do I have to create the counter's instance in my unit tests with a different way?