????Checker
?????????????????????????????????????????????????????????????д?????????????????????????????????????д?????????????????????????????в?????????С??????????????????????????????????Щ??????????
???????????????????????????????д?????????????????????
TEST(TestFoo?? JustDemo)
{
GetTestData(); // ???????????
CallSUT(); // ?????????
CheckSomething(); // ???????
}
?????????????????????????
????2. ????????????????
???????????????????????????????ü????????С????????????????????????????????????У???????????????????????????????Щ????????????????????ü????У??????????????????????????????????Щ??顣???????????Gtest??ASSERT_??EXPECT_??е???????????????????
????3. ???????????????????λ????
?????????????????????????????????????????????Failed???????????????????????Bug?????????????????д????????????????Щ????????????м????Щ??????????????????λ????????????????????????
int n = -1;
bool actualResult = Foo::Dosometing(n);
ASSERT_TRUE(actualResult)
??????????????????????????????????
Value of: actualResult
Actual: false
Expected:true
???????????????????????????????????á????????????????actualResult?????????????????2????????????????????????????Щ??????????????λ????
int n = -1;
bool actualResult = Foo::Dosometing(n);
ASSERT_TRUE(actualResult) << L"Call Foo::Dosometing(n) when n = " << n;
????4. ??????н?????????
???????????????????????????????е????????????????????????????????????????????????????????????к?????????????????????????????????????????????Щ????????????????o????????????????????Щ???????????????????????????ó???????????????????磬???????????????Windows????????????????????????÷????????????м?飬??????????????????????????????????????Windows??????Stop????Running?????м仹????????Padding?????????????????????ó?????????????????Σ????????????????????
ASSERT_TRUE(StartService('xxx'));
int tryTimes = 0;
int status = GetServiceStatus('xxx');
while (status != Running)
{
if (tryTimes >= 10)
break;
::Sleep(200);
tryTimes++;
status = GetServiceStatus('xxx');
}
ASSERT_EQ(Running?? status) << "Check the status after StartService('xxx')";
????5. ??????е??????????????
??????????t????e?????????????У?????棬?????????????????????????????????????磬?????????????????????棬?????Щ??????????????????????????????????????????Mock????????????????????GMock?????????????
????6. ????????????????????????
?????е?????????????????????????У???????????????????????????Щ???????????????????????????????????????????????TearDown?н???Щ????????????????????п?????????????????????????Щī??????????
????7. ????????????????????????????????????????
?????κ????????????????????????????????κ????????????н?????????????????????κ??????????????????ó?????????С??????????????????????????????????????????????????
????8. ??????????????????????????
????????????????淶??????????????????????????????????????磬???????????????????????
TEST(TestFoo?? Test)
TEST(TestFoo?? Normal)
TEST(TestFoo?? Alright)
???????????????????????????
TEST(TestFoo?? Return_True_When_ParameterN_Larger_Then_Zero)
TEST(TestFoo?? Return_False_When_ParameterN_Is_Zero)