简体   繁体   English

如何使用 resharper 在 QNX 虚拟机中运行 Google 测试(C++ 单元测试)?

[英]How to run Google tests (C++ unit tests) in a QNX Virtual machine, using resharper?

Currently how I run my unit tests:目前我如何运行我的单元测试:

I have a visual studio project, which builds a C++ google test (unit test) executable.我有一个 Visual Studio 项目,它构建了一个 C++ 谷歌测试(单元测试)可执行文件。

I then copy this exe to my Virtual Machine with QNX and run it manually, to get the unit test results.然后我使用 QNX 将此 exe 复制到我的虚拟机并手动运行它,以获得单元测试结果。

Can I use resharper to automate this?我可以使用 resharper 来自动执行此操作吗?

Resharper is able to detect and list tests from test file. Resharper 能够从测试文件中检测和列出测试。 But on running them, it throws error as it is not able to execute the tests in Windows.但是在运行它们时,它会抛出错误,因为它无法在 Windows 中执行测试。

Below is the exact error, I get, on running any of the tests.下面是我在运行任何测试时得到的确切错误。

ReSharper Ultimate – Error while running unit tests: Invalid path ReSharper Ultimate – 运行单元测试时出错:路径无效

Can I set up resharper and Visual studio environment, so that, I can run tests directly from visual studio, which will copy the exe to the Virtual Machine and give me the execution results?我可以设置 resharper 和 Visual Studio 环境,这样我就可以直接从 Visual Studio 运行测试,它会将 exe 复制到虚拟机并给出执行结果吗?

This will avoid me manually copy pasting the exe and running command to execute the tests?这将避免我手动复制粘贴 exe 并运行命令来执行测试?

I searched a lot regarding this in google.我在谷歌搜索了很多关于这个。 But couldn't find much help.但找不到太多帮助。

I'm new to google test and resharper.我是 google test 和 resharper 的新手。 So any help would be greatly appreciated.所以任何帮助将不胜感激。 Thanks in advance.提前致谢。

No, I'm afraid ReSharper cannot do that out of the box.不,恐怕 ReSharper 无法开箱即用。

Though it is quite powerful, so if you manage to write a script that does the VM specific part, ReSharper should be able to cope with it.虽然它非常强大,但如果您设法编写一个执行 VM 特定部分的脚本,ReSharper 应该能够应付它。 What that script needs to do is:该脚本需要做的是:

  • It must be run on the host (Windows).它必须在主机 (Windows) 上运行。
  • Copy the test binary to the QNX system in the VM.将测试二进制文件复制到 VM 中的 QNX 系统。
  • Execute the test.执行测试。
  • Capture the test's output and redirect it to the host's stdout .捕获测试的输出并将其重定向到主机的stdout

The ReSharper options can be set here:可以在此处设置 ReSharper 选项:

Menu ReSharper > Options...菜单ReSharper >选项...
In the left pane scroll down to Tools > Unit Testing > C++ Tests在左窗格中向下滚动到工具>单元测试> C++ 测试

In the text field Command: you need to enter the path to the script.在文本字段命令:您需要输入脚本的路径。
See https://www.jetbrains.com/help/resharper/Reference_Options_Tools_Unit_Testing_CPP_Tests.html for more details.有关更多详细信息,请参阅https://www.jetbrains.com/help/resharper/Reference_Options_Tools_Unit_Testing_CPP_Tests.html

I think you'll find that the msg box showing "ReSharper Ultimate – Error while running unit tests: Invalid path" has been caused by the last update to VS 2017, which has broken things.我想您会发现显示“ReSharper Ultimate – 运行单元测试时出错:无效路径”的 msg 框是由 VS 2017 的最后一次更新引起的,该更新已经破坏了一些东西。 I usually run my google tests through resharper c++, and until a few days ago, it worked.我通常通过 resharper c++ 运行我的谷歌测试,直到几天前,它才有效。 Now, I see this exact same error.现在,我看到了完全相同的错误。

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

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