is there a way to reset the whole environment after 1 TG ?

52 views
Skip to first unread message

Trung Đỗ Thành

unread,
Aug 25, 2021, 12:19:39 AM8/25/21
to cpputest

Hi friends,

I'm working within the projects and there are too many TGs and TCs, which cause the Data flow jumps up and down => Hard to maintain.
I did use the setup() and teardown() as much as possible but some cases it didnt work.

My idea:
- After 1 Test Group is finished, can we reset all the data/memory allocation to default just like typing "make check" ? because each time  "make check" is triggered, new process of code is initialized.
The flow should be: TG_A -> Fnish TG_A -> Reset Environment -> TG_B ....

Thank you so much.

Bas Vodde

unread,
Aug 27, 2021, 7:32:14 AM8/27/21
to cppu...@googlegroups.com

Hi,

I suspect the easiest is to make a TestPlugin. There you can store the test group name and when the test group name is different from the one stored, you can reset the environment.

Hope that helps!

Thanks,

Bas

--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cpputest/c34e6679-abe7-4fa0-b891-3152b8e27a0fn%40googlegroups.com.

Trung Đỗ Thành

unread,
Aug 28, 2021, 10:53:04 AM8/28/21
to cpputest
Hello Bas, 

Thanks for the respone. 
I looked for this Test Plugin but not so many clues. 
Can I have your suggestions where to find or some kind of tutorials? 

Thank you. 


Vào lúc 18:32:14 UTC+7 ngày Thứ Sáu, 27 tháng 8, 2021, Bas Vodde đã viết:

Bas Vodde

unread,
Aug 29, 2021, 3:03:24 AM8/29/21
to '张光辉' via cpputest

Hi,

In the CppUTestExt are a couple of examples of using the TestPlugin.

Thanks,

Bas

Trung Đỗ Thành

unread,
Aug 29, 2021, 8:02:15 AM8/29/21
to cpputest
Hi Bas, 

It is the folder to include mock.h isnt it? And this should also reset the static variable? 
Sorry for asking like a newbie but I have only worked with it for a year without many instructions from the colleagues, because they left the company. 

Thank you. 

Vào lúc 14:03:24 UTC+7 ngày Chủ Nhật, 29 tháng 8, 2021, Bas Vodde đã viết:
Reply all
Reply to author
Forward
0 new messages