??дCppUnit????????
???????????? ???????[ 2013/10/12 17:12:05 ] ????????
????2?????????????????
??????????????????????CppUnit??????????????У?
//???????TestSuite
CPPUNIT_TEST_SUITE(MathTest);
//????????????TestSuite???????μ????????????????????????
CPPUNIT_TEST(testAdd);
//TestSuite???????
CPPUNIT_TEST_SUITE_END();
??????????£?
Main.cpp
#include<iostream>
using namespace std;
#include "cppunit/extensions/TestFactoryRegistry.h"
#include "cppunit/ui/text/TestRunner.h"
#pragma comment (lib?? "cppunitd_dll.lib")
//?????????TestSuite???????????????????
int main()
{
CppUnit::TextUi::TestRunnerrunner;
//??????TestSuite?л????????TestSuite????в??????δ??????TestSuite
CppUnit::TestFactoryRegistry®istry = CppUnit::TestFactoryRegistry::getRegistry("alltest");
//??????TestSuite??TestRunner
runner.addTest(registry.makeTest());
//???????
runner.run();
return 0;
}
MathTest.h
/*??ú??CPPUNIT*/
#include "cppunit/extensions/HelperMacros.h"
class MathTest:public CppUnit::TestFixture
{
//???????TestSuite
CPPUNIT_TEST_SUITE(MathTest);
//????????????TestSuite???????μ????????????????????????
CPPUNIT_TEST(testAdd);
//TestSuite???????
CPPUNIT_TEST_SUITE_END();
public:
//?????????
void setUp();
//???????
voidtearDown();
//??????????????
void testAdd();
protected:
intm_value1??m_value2;
};
MathTest.cpp
#define MATHTEST_H
#ifdef MATHTEST_H
#include "MathTest.h"
#include "cppunit/TestAssert.h"
#endif
//?????TestSuite??????"alltest"??TestSuite?У????δ???壬??????????
//?????CPPUNIT_TEST_SUITE_REGISTRATION(MathTest)????????????δ??????TestSuite??
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(MathTest??"alltest");
void MathTest::setUp()
{
m_value1 = 2;
m_value2 = 3;
}
void MathTest::tearDown()
{
}
void MathTest::testAdd()
{
int ret =m_value1 + m_value2;
CPPUNIT_ASSERT(ret== 5);
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????