Here is the sample code
[TestClass]
public class UnitTest1
{
private Manager m_manager;
[TestInitialize]
public void TestInitialize()
{
var mySettings = new Settings { Web = { DefaultBrowser = BrowserType.Chrome } };
m_manager = new Manager(mySettings);
m_manager.Start();
m_manager.LaunchNewBrowser();
}
[TestCleanup]
public void TestCleanup()
{
m_manager.Dispose();
}
[TestMethod]
public void NavigateToGoogle()
{
m_manager.ActiveBrowser.NavigateTo("https://google.com/");
}
}
Assuming the following build to a telerick.dll
This is the command I am using from cmd prompt
MSTest.exe /testcontainer:"C:\POC1\Telerik\Telerik\bin\Debug\Telerik.dll"
When I run using command I am getting the following error, it runs perfectly fine when I use VisualStudio.
<Message>Initialization method TelerikTestingFramework.UnitTest1.TestInitialize threw exception. System.TypeInitializationException: System.TypeInitializationException: The type initializer for 'ArtOfTest.WebAii.Core.Settings' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified..</Message>
<StackTrace> at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimePropertyInfo property, RuntimeType caType)
at System.Reflection.RuntimePropertyInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
at ArtOfTest.WebAii.Core.Settings..cctor()
--- End of inner exception stack trace ---
at ArtOfTest.WebAii.Core.Settings..ctor()