SetUp method failed while running tests from teamcity

强颜欢笑 提交于 2020-01-04 06:14:16

问题


I am successfuly running tests locally via nunit. But when I try to run them through teamcity some tests are passed but some failed by giving the following error.

SetUp method failed. System.Runtime.InteropServices.COMException : Creating an instance of the COM component with CLSID {0002DF01-0000-0000-C000-000000000046} from the IClassFactory failed due to the following error: 800704a6. at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, LogonDialogHandler logonDialogHandler, Boolean createInNewProcess) at WatiN.Core.IE..ctor() at test.Setup() in C:\Tests.vb:line 14


回答1:


Not sure if this has been resolved or not but I was having the same error in 2 different test fixtures 1 written in C# the other written in VB.NET.

For the C# fixture all I need to do to resolve the issue is when I create a new instance of WatIn.IE, I added the second parameter to: IE var ie = new IE(url, true) The "true" tells WatIn to "createInNewProcess" which opens the next IE in a new process.

This, however, did not work for the test fixture written in VB.NET for some reason. For this fixture I had to call a method in one of our C# libraries to force an IE closure in each Tests "TearDown" method. The following C# code did the trick:

public static void CloseInternetExplorers()
{
  var processes = from process in Process.GetProcesses()
                  where process.ProcessName == "iexplore"
                  select process;

  foreach (var process in processes)
  {
    while (!process.HasExited)
    {
      process.Kill();
      process.WaitForExit();
    }
  }
}



回答2:


Have you tried to run the tests via Nunit on the teamcity server? This might give you more information.



来源:https://stackoverflow.com/questions/4346474/setup-method-failed-while-running-tests-from-teamcity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!