使用的xUnit测试与VS2015 UWP应用 [英] Using xUnit test with UWP app on VS2015

查看:797
本文介绍了使用的xUnit测试与VS2015 UWP应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个后续这个问题 。我跟着步骤这里描述和样品测试正常工作。这是我第一次拿到这个工作示例,但等到实际工作设置这也正是我有麻烦了。

This is a follow-up to this question. I followed the steps as described here and the sample tests work as expected. This is the first time I got to this working sample, but wait for the real working setup which is where I am having trouble.

作为下一个步骤,以测试我的应用程序,我用我的加UWP应用项目添加引用...来的xUnit测试项目。现在,我引用我的项目后,当我运行测试(所有测试浏览器面板VS2015运行)我收到以下错误:

As a next step to testing my app, I added my UWP app project using "Add Reference..." to the xUnit Test project. Now, after I referencing my project, when I run the test (Run All in Test Explorer pane VS2015) I get the following error:

错误有效载荷包含两个或多个文件具有相同的目标路径Assets\SplashScreen.scale-200.png'。源文件:
... \Projects\Sample\SampleUnitTest\Assets\SplashScreen.scale-200.png
... \Projects\Sample\Sample\Assets \SplashScreen.scale-200.png SampleUnitTest

有两个错误,就像上面那样,而是指 Square150x150Logo.scale-200.png Square44x44Logo.targetsize-24_altform-unplated.png 图像文件。

There are two more errors, exactly as above, but referring to Square150x150Logo.scale-200.png and Square44x44Logo.targetsize-24_altform-unplated.png image files.

我能够理解这些错误的意思;应用程序正在测试,测试项目都产生视觉资源(闪屏图像,标志,任务栏图标等)去往相同的输出,但这些都需要在注册应用程序(S)和run(本地计算机上我的情况)。我从来没有碰到过两个项目的这样一个有争议的问题输出相同的视觉资源,希望有人知道如何解决这个问题。如果我改变了项目类的项目,所以这是不是一种选择,单元测试不工作。

I can understand what these errors mean; the app being tested and the test project both generate visual resources (splash-screen image, logo, taskbar icon, etc.) destined for the same output but these are required to register the app(s) and run (on a local machine in my case). I've never come across such a contentious issue of two projects outputting the same visual resources and hopefully someone knows how to solve this. The unit test doesn't work if I change the project to Class project, so that is not an option.

你如何处理有争议的情况(WRT视觉资源)的xUnit的测试项目与项目之间进行测试?

How do you deal with the contentious situation (wrt visual resources) between an xUnit test project and a project being tested?

推荐答案

好吧,我想通了,如何解决视觉之间的冲突资源居住在Assets文件夹中,但是这将导致一种新的问题,为的xUnit(这将是我的后续问题)。

Okay, I figured out how to resolve the conflict between the visual resources residing in the Assets folder, but this leads to a new kind of issue for the xUnit (which will be my follow-up question).


  • 有关的xUnit项目,重命名的资产文件夹,比方说,图片(或任何你认为这是一个更好的替代名称)。

  • 点到 Package.appxmanifest 下面的xUnit项目文件并打开它作为一个代码文件。要做到这一点,选择Package.appxmanifest文件,然后按F7,或右键单击该文件,并选择查看代码上下文菜单命令。

  • 在代码文件,替换文件夹名称的资产不管你选择重命名Assets文件夹图片或。省省吧。

  • For the xUnit project, rename the Assets folder to, say, Images (or whatever you think is a better alternative name).
  • Point to the Package.appxmanifest file under xUnit project and open it as a code file. To do this, select the Package.appxmanifest file and press F7, or right-click the file and select the View Code context menu command.
  • In the code file, replace the folder name Assets with Images or whatever you chose to rename the Assets folder with. Save it.

现在的测试项目将编译并没有视觉资源输出冲突运行。关于但是的xUnit,正如我下一个问题描述,我们会打另外一个问题

Now the test project will compile and run with no visual resources output conflicts. With regard to xUnit however, we'll hit another problem as described in my next question.

这篇关于使用的xUnit测试与VS2015 UWP应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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