简体   繁体   English

如何在解决方案中的其他项目之间共享单元测试?

[英]How to share unit test between other projects in the solution?

My sincere apologies, if am duplicating the question here. 如果在这里重复这个问题,我表示诚挚的歉意。 I have set of tests that need to shared among 3 other projects and my application is web paged 我有一组需要在其他3个项目之间共享的测试,并且我的应用程序已在网页上

I am considering google as an example: 我正在考虑使用Google作为示例:

  • Shared Project Tests: Login to google 共享的项目测试:登录到Google
  • Google Drive Project: Add, Upload Tests Google云端硬盘项目:添加,上传测试
  • Google Mail Project - Compose, Read, Unread Tests Google Mail项目-撰写,阅读和未阅读的测试
  • Google Maps Project - Search Location Tests Google Maps Project-搜索位置测试

Output: 输出:

All the projects should have google login test added part of the test suite. 所有项目都应在测试套件中添加Google登录测试。

Thanks for your answers 谢谢你的回答

  1. Right click the solution you wish to add the existing test to 右键单击要添加现有测试的解决方案
  2. Click Add then Existing Item in the popup menu 单击添加,然后在弹出菜单中单击现有项。
  3. Find the existing file 查找现有文件
  4. Single-click it to select it 单击以选中它
  5. Click the DropDown icon next to the Add button 单击添加按钮旁边的下拉图标。
  6. Select "Add as link" 选择“添加为链接”

All the projects should have google login test added part of the test suite. 所有项目都应在测试套件中添加Google登录测试。

This is incorrect. 这是不正确的。 There should be only one Login module for which there is tests. 应该只有一个Login模块要进行测试。 All other projects should have no login logic whatsoever. 所有其他项目都应该没有登录逻辑。 They should either assume user is already logged in or only receive relevant permissions. 他们应该假设用户已经登录或仅获得相关权限。

Simply said : Duplicate tests signalize duplicate logic. 简单地说:重复测试表明重复逻辑。 And duplicate logic is A Bad Thing (tm). 重复的逻辑是一件坏事(tm)。

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

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