Skip to content

Commit

Permalink
Populated RunConfiguration Settings for RunAll. (#208)
Browse files Browse the repository at this point in the history
* Populated RunConfiguration Settings for RunAll.

* Added tests for DesignMode setting in run configuration.

* Updated name of test.
  • Loading branch information
harshjain2 authored Jun 28, 2017
1 parent 6933f0b commit e924c3c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Adapter/MSTest.CoreAdapter/MSTestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrame

// Populate the runsettings.
MSTestSettings.PopulateSettings(runContext);
RunConfigurationSettings.PopulateSettings(runContext);

// Scenarios that include testsettings or forcing a run via the legacy adapter are currently not supported in MSTestAdapter.
if (MSTestSettings.IsLegacyScenario(frameworkHandle))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public void RunTestsWithSourcesShouldNotExecuteTestsIfTestSettingsIsGiven()
{
var sources = new List<string> { Assembly.GetExecutingAssembly().Location };
string runSettingxml =
@"<RunSettings>
@"<RunSettings>
<MSTest>
<SettingsFile>DummyPath\\TestSettings1.testsettings</SettingsFile>
<ForcedLegacyMode>true</ForcedLegacyMode>
<IgnoreTestImpact>true</IgnoreTestImpact>
<IgnoreTestImpact>true</IgnoreTestImpact>
</MSTest>
</RunSettings>";
this.mockRunContext.Setup(dc => dc.RunSettings).Returns(this.mockRunSettings.Object);
Expand All @@ -89,5 +89,36 @@ public void RunTestsWithSourcesShouldNotExecuteTestsIfTestSettingsIsGiven()
// Test should not start if TestSettings is given.
this.mockFrameworkHandle.Verify(fh => fh.RecordStart(It.IsAny<TestCase>()), Times.Never);
}

[TestMethod]
public void RunTestsWithSourcesShouldSetDefaultDesignModeAsTrue()
{
var sources = new List<string> { Assembly.GetExecutingAssembly().Location };
string runSettingxml =
@"<RunSettings>
</RunSettings>";
this.mockRunContext.Setup(dc => dc.RunSettings).Returns(this.mockRunSettings.Object);
this.mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingxml);
this.mstestExecutor.RunTests(sources, this.mockRunContext.Object, this.mockFrameworkHandle.Object);

Assert.IsTrue(RunConfigurationSettings.ConfigurationSettings.DesignMode);
}

[TestMethod]
public void RunTestsWithSourcesShouldSetDesignModeAsFalseIfSpecifiedInRunSettings()
{
var sources = new List<string> { Assembly.GetExecutingAssembly().Location };
string runSettingxml =
@"<RunSettings>
<RunConfiguration>
<DesignMode>false</DesignMode>
</RunConfiguration>
</RunSettings>";
this.mockRunContext.Setup(dc => dc.RunSettings).Returns(this.mockRunSettings.Object);
this.mockRunSettings.Setup(rs => rs.SettingsXml).Returns(runSettingxml);
this.mstestExecutor.RunTests(sources, this.mockRunContext.Object, this.mockFrameworkHandle.Object);

Assert.IsFalse(RunConfigurationSettings.ConfigurationSettings.DesignMode);
}
}
}

0 comments on commit e924c3c

Please sign in to comment.