简体   繁体   English

Sharepoint 2010中Silverlight的编码UI测试

[英]Coded UI Testing of Silverlight in Sharepoint 2010

I am creating a Coded UI test for our system which runs on Sharepoint 2010. Part of the test sequence is creating a site; 我正在为在Sharepoint 2010上运行的系统创建一个编码UI测试。 Sharepoint's UI for creating sites runs on Silverlight. Sharepoint用于创建网站的UI在Silverlight上运行。 Therefore, I need to create a Coded UI test for a Silverlight component which is part of out-of-the-box Sharepoint rather then part of our application. 因此,我需要为Silverlight组件创建一个编码UI测试,它是现成的Sharepoint而不是我们的应用程序的一部分。 When I try to record a test, I get the following message: 当我尝试记录测试时,收到以下消息:

No Silverlight controls where detected. 没有检测到Silverlight控件。 Verify that the application under test is built using Silverlight assemblies with a version of 4.0 or greater and that a reference to the Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll assembly has been added to the project. 验证要使用4.0或更高版本的Silverlight程序集构建被测试的应用程序,并且已将对Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll程序集的引用添加到项目中。 For more information, see http://go.microsoft.com/fwlink/?LinkId=204562 有关更多信息,请参见http://go.microsoft.com/fwlink/?LinkId=204562

I have two questions: 我有两个问题:

1) How can I find out the Silverlight version which Sharepoint components are built against? 1)我如何找出构建了Sharepoint组件所针对的Silverlight版本? If they are built against Silverlight version 3.5 or earlier - I suppose the problem is unresolvable? 如果它们是针对Silverlight 3.5或更早版本构建的-我想问题是无法解决的?

2) Assuming the previous question is answered - how can I make Sharepoint's Silverlight components reference the SilverlightUIAutomationHelper.dll library? 2)假设回答了上一个问题-如何使Sharepoint的Silverlight组件引用SilverlightUIAutomationHelper.dll库? That seems problematic at best to me... 对我来说这似乎是个问题。

Silverlight version installed on the test machine is 4; 测试机上安装的Silverlight版本为4; Visual Studio Feature Pack 2 is installed. 已安装Visual Studio Feature Pack 2。

Thanks. 谢谢。

You could modify Sharepoint XAPs to simply add Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll in there. 您可以修改Sharepoint XAP,仅在其中添加Microsoft.VisualStudio.TestTools.UITest.Extension.SilverlightUIAutomationHelper.dll。 You don't really need the code itself to reference it, it just has to part of the package. 您实际上并不需要代码本身来引用它,它只需要包含在包的一部分中。 The XAP file is just a zip file so you should be able to modify this. XAP文件只是一个zip文件,因此您应该可以对其进行修改。

You will have to find where Sharepoint is getting the XAPs from and change the source (obviously you don't want to do this in prod boxes and there's even a license restriction for the Automation dll that prevents you from do it). 您将必须找到Sharepoint从何处获取XAP并更改源(显然,您不想在产品包装盒中执行此操作,甚至对Automation dll都有许可证限制也阻止您执行此操作)。 You could also write a Fiddler AutoResponder to modify the XAP file and add the dll before it gets to the browser. 您还可以编写Fiddler AutoResponder来修改XAP文件并在dll进入浏览器之前将其添加。 For an example of this have a look at this AutoResponder: https://bitbucket.org/mamadero/hackingsilverlightdemo/src/2fecb7b59dec/FiddlerAutoResponder 有关此示例,请查看此自动回复: https ://bitbucket.org/mamadero/hackingsilverlightdemo/src/2fecb7b59dec/FiddlerAutoResponder

You can't make SharePoint's Silverlight components reference the automation helper library unless you have the source code and can recompile them. 除非您拥有源代码并可以重新编译它们,否则您不能使SharePoint的Silverlight组件引用自动化帮助程序库。 So the answer to your first question doesn't really matter. 因此,第一个问题的答案并不重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM