Hi Team,
I am unable to read Test parameter value placed in .runsettings file.
TestSettings.runsettings
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<!-- Parameters used by tests at runtime -->
<TestRunParameters>
</TestRunParameters>
</RunSettings>
Code part :
[Given(@"I am on Novasol website(.*)")]
public void GivenIAmOnNovasolWebsite(string url)
{
var driver = _webDriver.Current;
try
{
var testContext = ScenarioContext.Current.ScenarioContainer.Resolve<Microsoft.VisualStudio.TestTools.UnitTesting.TestContext>();
}
It's throwing error :
Cannot create an instance of Microsoft.VisualStudio.TestTools.UnitTesting.TestContext because it is an abstract class.
I followed this answer but its not working for me.
I tried also this..but not successful..
namespace WebShopTestAutomation
{
[Binding]
public class CheckTheSearchFunctionalityToFindHolidayHomesSteps
{
private readonly WebDriver _webDriver;
private readonly TestContext _testContext;
private static string baseUrl { get; set; }
public CheckTheSearchFunctionalityToFindHolidayHomesSteps(WebDriver webDriver, TestContext testContext)
{
_webDriver = webDriver;
_testContext = testContext;
}
[Given(@"I am on Novasol website(.*)")]
public void GivenIAmOnNovasolWebsite(string url)
{
var driver = _webDriver.Current;
try
{
//var testContext = ScenarioContext.Current.ScenarioContainer.Resolve<Microsoft.VisualStudio.TestTools.UnitTesting.TestContext>();
var textContext = _testContext.Properties["seleniumBaseUrl"].ToString();
}
}
It's throwing error :
Cannot create an instance of Microsoft.VisualStudio.TestTools.UnitTesting.TestContext because it is an abstract class.