在没有测试框架的情况下使用c++在Appveyor中运行测试
Running tests in Appveyor with C++ without a testing framework
我们目前已经通过使用CMakes集成CTest在Travis Ci上设置了测试,它只是检查int main()
是否返回0以外的东西。
我们现在想在Appveyor的自动窗口构建中添加测试功能,同时仍然保留这个简单的返回值检查。
到目前为止,我们找到的每个用于Appveyors测试的资源都假设我们正在使用某种测试框架,比如MSTest,而我们并不打算这样做。
我发现你可以在Appveyor上运行自定义CMD和Powershell测试脚本,这听起来像是检查测试返回值的理想方法。
不幸的是,我们都没有使用CMD和Powershell的经验,也不知道如何实现这一点。
作为参考,下面是所讨论的项目:JNF_NEAT
你也可以在Windows上使用Cmake和Make。Cmake默认安装在构建工作虚拟机上,make应该在构建之前添加。这是你的顾问。我试图使它工作时创建的yml:
install:
# Install make for Windows unsing chocolatey
- ps: choco install make
build_script:
# Use the same commands which is used in .travis.yml
- cmake -DCMAKE_CXX_COMPILER=g++-6 CMakeLists.txt
# make fails here now
- make
- make test
# Start RDP access to connect and debug
on_finish:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
Cmake似乎工作,而make失败。我对这些工具不是很熟悉,但我相信您可以从这里开始调整它。我还添加了语句来创建RDP会话,以便您能够从构建worker连接和调试。
谢谢你,
Ilya。
我们设置了.appveyor。像这样:
test_script:
- C:projectsjnf-neatx64ReleaseXORSolver.exe
- C:projectsjnf-neatx64ReleaseEvenNumbers.exe
其中XORSolver.exe
和EvenNumbers.exe
是我们已经用来在CMake上运行的集成测试