升压测试中的命令行参数 [英] Command line args in boost test

查看:306
本文介绍了升压测试中的命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的boost测试处理额外的命令行参数。我使用它来自动测试一个功能,我需要指定的东西像servername,用户,通过,等...

I wish to process extra command line arguments for my boost test. I'm using it to test a feature automatically and I need to specify things like servername, user, pass, etc...

当我通过我的测试可执行文件extra命令除了已经编码为单元测试作为一个整体的参数,我得到一个堆腐败错误。

When I pass my test executable extra command arguments besides the ones already coded into unit tests as a whole, I get a heap corruption error.

我已经左右搜索,这是很难找到在哪里可以获得这些参数。现在看起来像我可能需要先设置它们,或者命令行解析器将做一些愚蠢的。

I've searched left and right and it was hard enough just to find where to gain access to those arguments. Now it looks like I perhaps need to set them up first as well or the command line parser is going to do something stupid.

任何人都知道如何添加命令行参数boost单元测试?

Anyone know how to add command line arguments to boost unit tests?

编辑 - 最小示例

#define BOOST_TEST_MODULE xxx
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(empty) {}

使用: exename hello

这似乎与什么都无关。这个问题应该删除。我不能谈论我的想法发生了,但我认为这可能与这有关:

This would appear to have nothing to do with anything. This question should be deleted. I can't talk about what I think happened, but I think it may be related to this:

http://forums.codeguru.com/showthread.php?506909-Boost-invalid-block -while-overloading-global-new-delete

OK,很明显mods已经决定这个问题不应该被删除, 。任何人搜索这:这可能是你的环境。它应该工作。我不能讨论我发现了什么,它是专有的,所以我的问题。您在这里找不到任何帮助。

MODS不会让我删除这个。

推荐答案

>查看主测试套件

boost::unit_test::framework::master_test_suite().argc
boost::unit_test::framework::master_test_suite().argv

你想要什么?

这篇关于升压测试中的命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆