Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Tools using : C++, Visual Studio 2010, Google Test Framework


Hello Friends,
I am trying to write a functiones_1 /method for my project, which will ask to user which all test cases are you going to run? It looks like below...,

Test_Cases_1
         |_TestNo1
         |_To2....so on
Test_Cases_2jhjk
         |_TestNo1
         |_TestNo2....so on
....
....so on
Test_Cases_N
         |_TestNo1
         |_TestNo2....so on

So, now the challenge is while running the project it should prompt me what all test cases you would like to execute? If I select
Test_Cases_1
and
Test_Cases_N
. Then it should execute these two test cases and should exclude all other from
Test_Cases_2 to .....
In result window also I would like to see the results of Test_Cases_1 and Test_Cases_N.

So, if I will see the GoogleTest, there is a method called test_case_to_run_count(); But all the test cases are getting registered with
Test_F()
method. So, I did lots of analysis, but still did not find any solution. Please help me.

My aim is to have a GUI, which will have the Tree of TestCases and TestNos. User will select the TestCases/TestNos to execute. So, how to do it?
Posted

1 solution

C++
int main(int argc, char **argv) 
{     
int i = 1;        
 vector<string> str;        
 str.push_back("*first*:*second*");         
str.push_back("*third*:*fourth*");         
str.push_back("*fifth.fifthtestname*");         
for(i = 0; i != str.size(); i++)         
{             
::testing::GTEST_FLAG(filter) = str.at(i);              
InitGoogleTest(&argc, argv);              
RUN_ALL_TESTS();             
// getchar();        
 }         
getchar(); 
} </string>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900