运行提升测试项目时出错:测试用例名称:没有这样的文件或目录
Error while running boost test project: testcaseName: No such file or directory
我正在尝试使用boost单元测试套件。
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE main_test_module
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_suite.hpp>
.... // introducing some functions and variables here
BOOST_AUTO_TEST_CASE(fileComparatorTestCase)
{
Logger() << "Testing file comparator";
bool res;
res = compare(file1Path, file1Path);
BOOST_REQUIRE_EQUAL(res, true);
res = compare(file2Path, file2Path);
BOOST_REQUIRE_EQUAL(res, true);
res = compare(file1Path, file3Path);
BOOST_REQUIRE_EQUAL(res, false);
res = compare(file1Path, file2Path);
BOOST_REQUIRE_EQUAL(res, false);
Logger() << "Ended testing file comparator";
}
我也在链接boost_unit_test_framework图书馆。这段代码编译正常,但是当我尝试运行测试运行程序时,它失败并显示以下错误:
Running 1 test case...
unknown location(0): fatal error in "fileComparatorTestCase": std::exception: No such file or directory
关于如何解决它的任何想法?
显然,要么
-
Logger()
无法打开输出位置进行写入;或 - 您正在测试的
compare
函数会检查您传递的文件/路径是否存在。
尝试评论内容,直到找到罪魁祸首。如果 Boost 出现异常,通常可以使用更广泛的异常信息。否则,源代码或诸如strace
之类的技巧可以告诉您发生了什么。
相关文章:
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- 为测试目标创建具有不同源文件夹的文件
- 更正 CMakeList.txt 用于谷歌测试的文件?
- MinGw 无法从 cmake 编译测试文件
- clang 的 libFuzzer 可以在同一二进制文件中测试超过 1 个 API 吗?
- C++ gmock - 我们如何在单元测试 cpp 文件中读取/获取 cpp 文件函数的参数值
- CMake GoogleTests在我的测试文件中找不到导入的头文件
- 为什么使用_access时只读测试对读写文件有效
- 使用gtest时,在头文件中而不是.cpp文件中具有可测试类的利弊
- 链接CPP文件进行测试时发生LNK2019错误
- 谷歌测试可执行文件中的单元测试未被vstest选中
- 使用 ctest 的每个测试都需要单独的文件吗?
- 在单元测试项目中包括 .c 文件,并从多个 cpp 文件访问它而不会出现链接问题
- 谷歌测试读写同一文件失败
- 为多个测试文件构建可执行文件
- Centos6 gcc6:编译简单的 c++11 测试文件时,默认的 ABI 不拾取
- 为什么生成文件返回 g++: 错误: h 文件或目录 make: *** [生成文件:12: 测试] 错误 1?
- Bazel:如何在测试前运行py_binary以生成输入文件
- 将我的主输出库与测试可执行文件链接时出现问题
- Visual Studio单元使用具有相对路径的文件测试