- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
所以我正在努力创建我的第一个单元测试。我正在使用 Google Test,该版本目前内置于 Visual Studio 2017 中。这是对概念验证的一次尝试,非常简单。
我在测试代码的解决方案中有一个项目:test.cpp
#include "pch.h"
#include "../ConsoleApplication1/ConsoleApplication1.cpp"
TEST(SumTest, FirstTest) {
EXPECT_EQ(6, sum(2, 4));
}
TEST(SumTest, SecondTest) {
EXPECT_EQ(1, 1);
EXPECT_TRUE(true);
}
我在 ConsoleApplication1.cpp 中有一个简单的测试方法
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int sum(int a, int b);
int main()
{
int x = sum(2, 4);
printf("The answer is: %d \n", x);
}
int sum(int a, int b) {
return a + b;
}
一切都编译得很好,但是当我从测试资源管理器菜单中单击“全部运行”时,我得到以下输出:
[5/7/2018 4:17:42 PM Informational] ------ Run test started ------
[5/7/2018 4:17:43 PM Informational] Test Adapter for Google Test: Test execution starting...
[5/7/2018 4:17:43 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:17:43 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe
[5/7/2018 4:17:43 PM Informational] Running 0 tests...
[5/7/2018 4:17:43 PM Informational] Google Test execution completed, overall duration: 00:00:00.3666448
[5/7/2018 4:17:43 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:17:44 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:17:44 PM Warning] No test is available in C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[5/7/2018 4:17:44 PM Informational] ========== Run test finished: 0 run (0:00:01.9324761) ==========
[5/7/2018 4:20:39 PM Informational] ------ Discover test started ------
[5/7/2018 4:20:40 PM Informational] Test Adapter for Google Test: Test discovery starting...
[5/7/2018 4:20:40 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:20:40 PM Informational] Test discovery completed, overall duration: 00:00:00.3954411
[5/7/2018 4:20:40 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:20:40 PM Informational] ========== Discover test finished: 0 found (0:00:01.8597435) ==========
[5/7/2018 4:20:47 PM Informational] ------ Discover test started ------
[5/7/2018 4:20:48 PM Informational] Test Adapter for Google Test: Test discovery starting...
[5/7/2018 4:20:49 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:20:49 PM Informational] Test discovery completed, overall duration: 00:00:00.3670275
[5/7/2018 4:20:49 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:20:49 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:20:49 PM Informational] ========== Discover test finished: 0 found (0:00:01.873206) ==========
[5/7/2018 4:21:36 PM Informational] ------ Run test started ------
[5/7/2018 4:21:37 PM Informational] Test Adapter for Google Test: Test execution starting...
[5/7/2018 4:21:38 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe
[5/7/2018 4:21:38 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:21:38 PM Informational] Running 0 tests...
[5/7/2018 4:21:38 PM Informational] Google Test execution completed, overall duration: 00:00:00.3844604
[5/7/2018 4:21:38 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:21:38 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:21:38 PM Warning] No test is available in C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[5/7/2018 4:21:38 PM Informational] ========== Run test finished: 0 run (0:00:02.0203611) ==========
[5/7/2018 4:27:21 PM Informational] ------ Run test started ------
[5/7/2018 4:27:34 PM Informational] Test Adapter for Google Test: Test execution starting...
[5/7/2018 4:27:35 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:27:35 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe
[5/7/2018 4:27:35 PM Informational] Running 0 tests...
[5/7/2018 4:27:35 PM Informational] Google Test execution completed, overall duration: 00:00:00.6936342
[5/7/2018 4:27:35 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:27:35 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:27:35 PM Warning] No test is available in C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[5/7/2018 4:27:35 PM Informational] ========== Run test finished: 0 run (0:00:14.3144745) ==========
[5/7/2018 4:27:59 PM Informational] ------ Run test started ------
[5/7/2018 4:28:11 PM Informational] Test Adapter for Google Test: Test execution starting...
[5/7/2018 4:28:11 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe
[5/7/2018 4:28:11 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:28:11 PM Informational] Running 0 tests...
[5/7/2018 4:28:11 PM Informational] Google Test execution completed, overall duration: 00:00:00.6451099
[5/7/2018 4:28:11 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:28:12 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:28:12 PM Warning] No test is available in C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[5/7/2018 4:28:12 PM Informational] ========== Run test finished: 0 run (0:00:12.9601734) ==========
[5/7/2018 4:29:59 PM Informational] ------ Run test started ------
[5/7/2018 4:30:59 PM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Failed to initialize client proxy: could not connect to test process.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
[5/7/2018 4:30:59 PM Error] Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Failed to initialize client proxy: could not connect to test process.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, CancellationToken cancellationToken)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria testRunCriteria, ITestRunEventsHandler eventHandler)
[5/7/2018 4:30:59 PM Informational] ========== Run test finished: 0 run (0:01:00.2319577) ==========
[5/7/2018 4:34:34 PM Informational] ------ Discover test started ------
[5/7/2018 4:34:36 PM Informational] Test Adapter for Google Test: Test discovery starting...
[5/7/2018 4:34:36 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:34:36 PM Informational] Test discovery completed, overall duration: 00:00:00.3801077
[5/7/2018 4:34:36 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:34:36 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:34:36 PM Informational] ========== Discover test finished: 0 found (0:00:01.89196) ==========
[5/7/2018 4:34:41 PM Informational] ------ Run test started ------
[5/7/2018 4:34:42 PM Informational] Test Adapter for Google Test: Test execution starting...
[5/7/2018 4:34:43 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe
[5/7/2018 4:34:43 PM Informational] Found 0 tests in executable C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe
[5/7/2018 4:34:43 PM Informational] Running 0 tests...
[5/7/2018 4:34:43 PM Informational] Google Test execution completed, overall duration: 00:00:00.3975222
[5/7/2018 4:34:43 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:34:43 PM Warning] Could not locate debug symbols for 'C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe'. To make use of '--list_content' discovery, ensure that debug symbols are available or make use of '<ForceListContent>' via a .runsettings file.
[5/7/2018 4:34:43 PM Warning] No test is available in C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\ConsoleApplication1.exe C:\Users\ruggiero\source\repos\Google Test - Sandbox\Debug\Google Test - Sandbox.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
[5/7/2018 4:34:43 PM Informational] ========== Run test finished: 0 run (0:00:01.9803681) ==========
它似乎没有发现我编写的任何一个测试,我不确定为什么。
最佳答案
常见案例中的GoogleTest框架requires main
中的 RUN_ALL_TESTS
宏:
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
然后您可以将您的测试添加到不同的 cpp
文件中,引擎盖下的魔法将启动所有这些并显示漂亮的报告。
不过,即使没有这个宏,您也可以使用 Google Tests。看这个answer .
关于c++ - 谷歌测试没有找到任何测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50222112/
这两个包看起来非常相似: http://www.passportjs.org/packages/passport-google-oauth2/ http://www.passportjs.org/pa
我想在我的网站上添加通过 Google 和 Twitter 登录的按钮。我需要只使用应用程序的客户端而不是服务器端来完成此操作。但我没有找到任何 API。对于我发现的所有内容,我需要使用带有 key
我使用此链接通过 google plus 共享我的页面。 https://plus.google.com/share?url=http%3A%2F%2Fexample.com%2Fcompany%2
我正在尝试学习 google API,并且我的经验是使用 Python,因此我尝试使用 google api python 客户端来访问一些 google 服务,但在构建服务对象时遇到错误。 从 ap
在其实际的实时托管平台上构建实时站点的努力中,有没有办法告诉谷歌不要索引该网站?我发现了以下内容: http://support.google.com/webmasters/bin/answer.py
我正在开发一个 iOS 应用程序。当我运行用于 google+ 登录的程序时,在我点击允许访问按钮后,会显示此消息。 You've reached this page because we have
我有一个非常复杂的网站,每个页面包含 11 个 js 文件。 我最近添加了 google +1 按钮,代码如下: 这会正确显示 +1 按钮,直到我单击它。当我单击它时,出现此错误:https://
我正在尝试使用 google API 创建一个 html 文件,以便在 google MAPS 上显示 KML 文件。 这是 HTML 代码: function initMap() {
我是使用 Google Benchmark 的新手,在本地运行代码与在 Quick-Bench.com 上运行代码时,我收到了运行相同基准测试(下方)的不同结果,该基准测试使用 C++ 检索本地时间.
我已按照 Google 网站上的说明通过添加以下元标记在我的 AngularJS 网站上启用 Ajax 抓取: 呈现的内容有一些链接,如: User 1 User 2 User 3 还有一些呈现动态
通过 Google 手册实现 Google AppInvite - link . 启动 Invite Activity 并在 LogCat 中获取下一步: E/AppInviteAgent: Get
那么有人用过 Google 的 Go 吗?我想知道数学性能(例如触发器)与其他具有垃圾收集器的语言(如 Java 或 .NET)相比如何? 有人调查过吗? 最佳答案 理论性能:纯 Go 程序的理论性能
Stackdriver 测试我的网站启动速度慢 我们使用 cloudflare 作为我们的站点 CDN 提供商。我们使用 stackdriver 从外部测试站点可用性,我们将时间检查间隔设置为 1 分
我正在尝试使用 stax.GeneralConv() ( https://jax.readthedocs.io/en/latest/_modules/jax/experimental/stax.htm
我有一个从谷歌金融中提取日内数据的软件。但是,由于昨天 Google 更新了 API,所以软件报错了 Conversion from string HTML HEAD meta http-equiv=
我们在尝试从 Google 获取 oAuth token 时遇到“redirect_uri_mismatch”错误: [client 127.0.0.1:49892] {\n "error" : "
我的网站正在使用 Google reCAPTCHA 控件,但我听说它被阻止了 中国,反正我看到有人报告说将 API 更改为 https://www.recaptcha.net在中国工作? Anyone
背景 WordPress Google Adsense 谷歌自动插入 anchor 定广告 https://pptmon.com 问题 如下图所示,主播广告的容器高度太大了! 如何调整高度? 这是谷歌
我在使用 Google Colab 时遇到问题。当我想制作一个新的 Python3 Notebook 时,由于我登录了我的 Google 帐户,因此无法加载刚刚打开的新页面。 我该怎么办? 感谢您的帮
我正在使用 facebook和 google oauth2使用 passport js 登录, 有了这个流 用户点击登录按钮 重定向到 facebook/google auth 页面(取决于用户选择的
我是一名优秀的程序员,十分优秀!