无法在Windows 8.1上以其他用户身份运行编码的UI测试 [英] Cannot run Coded UI tests as different user on Windows 8.1

查看:64
本文介绍了无法在Windows 8.1上以其他用户身份运行编码的UI测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个编码UI测试套件,它取决于以不同用户身份运行我们的测试。我们通过使用以下ApplicationUnderTest.Launch重载来实现此目的:

We have a Coded UI test suite which depends on running our tests as different users. We accomplish this by using the following ApplicationUnderTest.Launch overload:


ApplicationUnderTest.Launch(browserLocation,null,url,username,GetSecurePassword (密码),域);

我们使用Visual Studio 2013 Premium(更新3),并且在Windows 7和Windows 2012 R2上运行时没有问题。现在,我们已经迁移到Windows 8.1,并且不再能够以其他用户身份运行。我们收到以下臭名昭著的错误:

We use Visual Studio 2013 premium (update 3) and had no problem when running on Windows 7 and Windows 2012 R2. Now we have migrated to Windows 8.1 and we are no longer able to run as a different user. We get the following infamous error:


无法启动应用程序。这可能是由于以下原因之一:
1)该应用程序的另一个实例已在运行,并且一次只能运行一个实例。
2)应用程序启动了另一个进程,现在已停止。您可能需要直接启动该过程。
3)您对此应用程序没有足够的特权。文件:C:\Program Files\Internet Explorer\iexplore.exe。

The application cannot be started. This could be due to one of the following reasons: 1) Another instance of the application is already running and only one instance can be running at a time. 2) The application started another process and has now stopped. You may need to launch the process directly. 3) You do not have sufficient privileges for this application." File: C:\Program Files\Internet Explorer\iexplore.exe.

当我们以当前用户身份运行时,我们能够成功运行编码的UI测试:

We are able to run Coded UI tests successfully when we run as the current user like so:


ApplicationUnderTest.Launch(browserLocation,null,url);

不幸的是,这样做不允许我们进行测试。我们以管理员身份运行Visual Studio,而我们运行的所有测试用户都被设置为管理员本身。您是否知道可能是什么问题?

Unfortunately doing this does not allow us to exercise our tests. We are running Visual Studio as Administrators and all the test users we run as are set up as Administrators themselves. Do you have any idea of what the problem might be?

这是我们经历的堆栈跟踪:

This is the stack trace we experience:


在Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.ThrowIfProcessNotValid(Process process)$ Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.SetCurrentProcessPrivate(过程值)中的b $ b Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest中的
lt;> c__DisplayClassb。< set_Process> b__a()
,位于Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod [T](Func`1函数,UITestControl控件,布尔型firePlaybackErrorEvent,布尔型LogAsAction)
在Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.set_Process(过程值)
在Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.Start(ProcessStartInfo startInfo)
在Microsoft.VisualStudio.TestTools.UITesting。 Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod [T]中的ApplicationUnderTest.cctDisplayClass10.btor()
(Func`1函数,UITestControl控件,布尔型firePlaybackErrorEvent,布尔值LogAsAction) Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest..ctor中的
(字符串文件名,字符串AlternativeFileName,字符串参数,字符串用户名,SecureString密码,字符串域)Microsoft.VisualStudio.TestTools.U中的
ITesting.ApplicationUnderTest。<> c__DisplayClass4。< launch> b__3()
在Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod [T](Func`1函数,UITestControl控件,布尔型firePlaybackErrorEvent,布尔型LogAsAction )
在Microsoft.VisualStudio.TestTools.UITesting.ApplicationUnderTest.Launch(字符串fileName,字符串alterFileName,字符串参数,字符串userName,SecureString密码,字符串域)Pantheon.Web.AppsPortal.UITests.Utilities中的
.TestBase.LaunchBrowserWindow(字符串浏览器位置,字符串url,字符串用户名,字符串密码,字符串域)在c:\dev_jr\AppsPortal\Development\Pantheon.Web.AppsPortal.UITests\Utilities\TestBase.cs中:第122行

TestBase.cs:第122行看起来像这样:

TestBase.cs:line 122 looks like this:


var app = ApplicationUnderTest.Launch(browserLocation,null,url,用户名,GetSecurePassword(password),域);

推荐答案

自从我发布此问题以来,我进行了更多的挖掘和调查。当测试以Windows 8.1上的另一个用户身份运行时, Visual Studio 2013 Update 3似乎破坏了编码UI的测试。可以在MSDN上的此处找到交互的详细信息:

Since I posted this question I did some more digging and investigation. It seems that Visual Studio 2013 Update 3 broke Coded UI testing when tests run as another user on Windows 8.1. Details of the interaction can be found on MSDN here:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/f48665e4-569a-4b67-9bdb-5522b2adffb2/cannot-run-coded-ui-tests-as-different-user-on -windows-81?forum = vsmantest#28c9decb-b579-4848-a7a9-f41c57584d59

感谢Crystal Zhu的帮助。不幸的是,由于Microsoft(据我所知,Crystal)使除最新的Update Pack之外的任何东西都无法获得,因此似乎无法回滚到Update 2。这是非常令人沮丧的。我们俩都记录了Microsoft的问题:

Thanks to Crystal Zhu for helping out. Unfortunately rolling back to Update 2 does not seem to be possible as Microsoft have (as far as Crystal and I can tell) made it impossible to obtain anything but the latest Update pack. Which is very frustrating. Both of us logged the issue with Microsoft:

https://connect.microsoft .com / VisualStudio / feedbackdetail / view / 949052 / vs2013-update-3-code-ui-test-can-launch-ie-under-a-different-user-on-windows-8-1-machine-with-ie11

https://connect.microsoft.com/VisualStudio/feedbackdetail/view/949049/coded-ui-cannot-不幸的是,作为一个具有Visual Studio 2013更新3的用户运行

不幸的是,目前还没有任何回应。我已经尝试过(但失败了)通过官方渠道进行记录,但是我只能报告我失败了,并且被一百万个呼叫中心的对话打败了。

Unfortunately there has been no response as yet. I've tried (and failed) to log this through the official channels but I can only report that I have failed and been beaten down by a million call centre conversations.

希望这不是故事的结局,但我想记录一下已经取得的(微不足道的)进展。我不会将其标记为可接受的答案,因为问题仍然存在。

Hopefully this isn't the end of the story but I wanted to log the (insignificant) progress that there has been. I won't mark this as an accepted answer because the problem still remains for now.

编辑:2015年1月7日:

07 Jan 2015:

由于没有任何进展,我们最终通过更改模仿机制来解决此问题。这不是一个小小的开关,我认为它很hacky。万一有用,我在这里写了一下:(恐怕这是一篇很长的文章,所以将其转移到SO上并没有什么意义)

Since there was no progress on this we ended up working around this by changing the impersonation mechanism. It's not a small switch and I consider it rather hacky. In case it's helpful I blogged about it here: (I'm afraid it's rather a long post and so moving it across to SO didn't really make sense)

< a href = http://blog.icanmakethiswork.io/2014/11/Coded-UI-IE-11-and-the-runas-problem.html rel = nofollow> http://blog.icanmakethiswork。 io / 2014/11 / Coded-UI-IE-11-and-the-runas-problem.html

这篇关于无法在Windows 8.1上以其他用户身份运行编码的UI测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆