我在使用这一格式的测试的基础上,从数据库中发现了新的测试案例:
TEST_F(CLASSNAME, TESTCASENAME)
现在有这样的一个试验案例,即自动格式似乎如此:
TEST_F(
CLASSNAME,
TESTCASENAME)
Before I get each piece of information based on the format TEST_F(CLASSNAME, TESTCASENAME) as follows:
print("Looking for new tests")
for root, dirs, files in os.walk(cpp_tests_dir_path):
for file in files:
with open(os.path.join(root, file), encoding="utf8", errors= ignore ) as f:
for line in f:
if "TEST_F(" in line:
data = line.split("TEST_F(")[1]
c_class = data.split(",")[0]
c_test_case = data.split(",")[1].split(")")[0].strip().split()[0]
但是,如果有一个像我前面提到的那样具有如此长的名称和格式的试验案例。 已被分离成多个线
TEST_F(
CLASSNAME,
TESTCASENAME)
我如何调整逻辑,以获得每项价值的价值?
更新额外信息,测试点命名应如下:
TEST_F(CMilestoneChallengeModelTest, SetChallenges_ListenerNotRegistered_ListenerIsNotNotified)
问题1
TEST_F(
CDailyWinTest,
GIVEN_DailyWinRevamped_WHEN_PlayerWinGameinDay_AND_DoesntCollectAllStickers_THEN_CelebrationPopupAppear)
Update the code base on the comment
print("Looking for new tests")
for root, dirs, files in os.walk(cpp_tests_dir_path):
for file in files:
with open(os.path.join(root, file), encoding="utf8", errors= ignore ) as f:
content = f.read()
test_cases = re.findall(r TEST_F(s*w*s*,s*w*s*) , content)
for line in test_cases:
if "TEST_F(" in line:
data = line.split("TEST_F(")[1]
c_class = data.split(",")[0]
c_test_case = data.split(",")[1].split(")")[0].strip().split()[0]