コード例 #1
0
        public void TryGetLegacySettingsForRunSettingsWithValidLegacySettingsShouldReturnTrueAndListForLegacySettingElements()
        {
            string runSettingsXml = @"<RunSettings>
                                       <LegacySettings>
	                                        <Deployment enabled=""true"" deploySatelliteAssemblies=""true"" >
                                                <DeploymentItem filename="".\test.txt"" />
                                            </Deployment>
                                            <Scripts setupScript="".\setup.bat"" cleanupScript="".\cleanup.bat"" />
                                            <Execution hostProcessPlatform=""MSIL"" parallelTestCount=""4"">
                                                <Timeouts testTimeout=""120"" />
                                                <TestTypeSpecific>
                                                    <UnitTestRunConfig>
                                                        <AssemblyResolution />
                                                    </UnitTestRunConfig>
                                                </TestTypeSpecific>
                                                <Hosts />
                                            </Execution>
                                       </LegacySettings>
                                      </RunSettings>";

            var expectedElements             = "Deployment, Scripts, Execution, AssemblyResolution, Timeouts, Hosts";
            var expectedDeploymentAttributes = "enabled, deploySatelliteAssemblies";
            var expectedExecutionAttributes  = "hostProcessPlatform, parallelTestCount";

            Assert.IsTrue(InferRunSettingsHelper.TryGetLegacySettingElements(runSettingsXml, out Dictionary <string, string> legacySettings));
            Assert.AreEqual(3, legacySettings.Count, "count does not match");
            Assert.AreEqual(expectedElements, legacySettings["Elements"]);
            Assert.AreEqual(expectedDeploymentAttributes, legacySettings["DeploymentAttributes"]);
            Assert.AreEqual(expectedExecutionAttributes, legacySettings["ExecutionAttributes"]);
        }
コード例 #2
0
        public void TryGetLegacySettingsForRunSettingsWithoutLegacySettingsShouldReturnFalse()
        {
            string runSettingsXml = @"<RunSettings>
                                      </RunSettings>";

            Assert.IsFalse(InferRunSettingsHelper.TryGetLegacySettingElements(runSettingsXml, out Dictionary <string, string> legacySettings));
        }
コード例 #3
0
        public void TryGetLegacySettingsForRunSettingsWithEmptyLegacySettingsShouldReturnTrueAndEmptyListForLegacySettingElements()
        {
            string runSettingsXml = @"<RunSettings>
                                        <LegacySettings>
                                        </LegacySettings>
                                      </RunSettings>";

            Assert.IsTrue(InferRunSettingsHelper.TryGetLegacySettingElements(runSettingsXml, out Dictionary <string, string> legacySettings));
            Assert.AreEqual(0, legacySettings.Count);
        }
コード例 #4
0
        private void LogTelemetryForLegacySettings(IRequestData requestData, string runsettings)
        {
            requestData.MetricsCollection.Add(TelemetryDataConstants.TestSettingsUsed, InferRunSettingsHelper.IsTestSettingsEnabled(runsettings));

            if (InferRunSettingsHelper.TryGetLegacySettingElements(runsettings, out Dictionary <string, string> legacySettingsTelemetry))
            {
                foreach (var ciData in legacySettingsTelemetry)
                {
                    // We are collecting telemetry for the legacy nodes and attributes used in the runsettings.
                    requestData.MetricsCollection.Add(string.Format("{0}.{1}", TelemetryDataConstants.LegacySettingPrefix, ciData.Key), ciData.Value);
                }
            }
        }