Skip to content

Commit

Permalink
Adding Telemetry for DisableAppDomain flag (#1767) (#1787)
Browse files Browse the repository at this point in the history
* Adding Telemetry for DisableAppDomain flag

* Test fix

(cherry picked from commit b2719f3)
  • Loading branch information
smadala authored Oct 8, 2018
1 parent adbf6bf commit 25fb7c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public static class TelemetryDataConstants

public static string TestSettingsUsed = "VS.TestRun.IsTestSettingsUsed";

public static string DisableAppDomain = "VS.TestRun.DisableAppDomain";

// All data related to legacy settings nodes will be prefixed with this.
public static string LegacySettingPrefix = "VS.TestRun.LegacySettings";

Expand Down
4 changes: 4 additions & 0 deletions src/vstest.console/TestPlatformHelpers/TestRequestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,10 @@ private void CollectMetrics(IRequestData requestData, RunConfiguration runConfig

// Collecting TargetOS
requestData.MetricsCollection.Add(TelemetryDataConstants.TargetOS, new PlatformEnvironment().OperatingSystemVersion);

//Collecting DisableAppDomain
requestData.MetricsCollection.Add(TelemetryDataConstants.DisableAppDomain, runConfiguration.DisableAppDomain);

}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public void DiscoverTestsShouldCollectMetrics()
<MaxCpuCount>2</MaxCpuCount>
<TargetPlatform>x86</TargetPlatform>
<TargetFrameworkVersion>Framework35</TargetFrameworkVersion>
<DisableAppDomain>True</DisableAppDomain>
</RunConfiguration>
<MSPhoneTest>
<TargetDevice>169.254.193.190</TargetDevice>
Expand Down Expand Up @@ -296,15 +297,15 @@ public void DiscoverTestsShouldCollectMetrics()
this.testRequestManager.DiscoverTests(payload, mockDiscoveryRegistrar.Object, mockProtocolConfig);

// Verify.
object targetDevice;
object maxcount;
object targetPlatform;
object targetDevice, maxcount, targetPlatform, disableAppDomain;
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.TargetDevice, out targetDevice));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.MaxCPUcount, out maxcount));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.TargetPlatform, out targetPlatform));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.DisableAppDomain, out disableAppDomain));
Assert.AreEqual("Other", targetDevice);
Assert.AreEqual(2, maxcount);
Assert.AreEqual("X86", targetPlatform.ToString());
Assert.AreEqual(true, disableAppDomain);
}

[TestMethod]
Expand Down Expand Up @@ -1062,6 +1063,7 @@ public void RunTestsShouldCollectMetrics()
<MaxCpuCount>2</MaxCpuCount>
<TargetPlatform>x86</TargetPlatform>
<TargetFrameworkVersion>Framework35</TargetFrameworkVersion>
<DisableAppDomain>True</DisableAppDomain>
</RunConfiguration>
<MSPhoneTest>
<TargetDevice>169.254.193.190</TargetDevice>
Expand Down Expand Up @@ -1089,16 +1091,15 @@ public void RunTestsShouldCollectMetrics()
this.testRequestManager.RunTests(payload, new Mock<ITestHostLauncher>().Object, new Mock<ITestRunEventsRegistrar>().Object, mockProtocolConfig);

// Verify
// Verify.
object targetDevice;
object maxcount;
object targetPlatform;
object targetDevice, maxcount, targetPlatform, disableAppDomain;
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.TargetDevice, out targetDevice));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.MaxCPUcount, out maxcount));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.TargetPlatform, out targetPlatform));
Assert.IsTrue(actualRequestData.MetricsCollection.Metrics.TryGetValue(TelemetryDataConstants.DisableAppDomain, out disableAppDomain));
Assert.AreEqual("Other", targetDevice);
Assert.AreEqual(2, maxcount);
Assert.AreEqual("X86", targetPlatform.ToString());
Assert.AreEqual(true, disableAppDomain);
}

[TestMethod]
Expand Down

0 comments on commit 25fb7c2

Please sign in to comment.