CppUTest TestPlugin changes


I've recently made some very kewl CppUTest changes (at least, I think they are nice). CppUTest has a TestPlugin design. This means that you can write "Plugins" and add them in your main method. The Plugins is called before every setup and after ever teardown (automatically). This enables you to add general checking of things and works especially well with stubbing out some of the OS things.

Let me give some better example. For some embedded project I wrote some MutexPlugin. We stubbed out all the mutex locks and unlocks in the unit tests. Then, instead of doings mutex locks, I'd record the lock plus filename, linenumber (using macro magic and __FILE__ and __LINE__). Then I wrote the MutexPlugin which checks the the records to see if there is no inconsistency (dangling mutex, double locked mutex etc).

Then we'll install the Plugin in the main like this:

MutexPlugin mutexPlugin;
TestRegistry::getCurrentRegistry()->installPlugin(&mutexPlugin);

Now every test you ever write will automatically have mutex consistency checking and will fail automatically if there is something not consistent. Now... this is nothing new, we added this support to CppUTest already some time ago. However, now I added support for command line options to the TestPlugin. So, via command line, you can pass options to your Plugin by the -p option (CppUtest will pass all the -p options to all the installed plugins to see if they know what they mean, if none uses them then it will report an error).

So,  what you can do with this? Well, if we take our MutexPlugin as example, we can add a -pMutexVerbose option to the plugin which will output all the mutex locks and unlocks (again, plus line and file). That's a rather handy debugging and profiling option (especially combined with the -n option to run just one test). I did the same with the MemoryLeak plugin, so that you can dump all the dynamic memory allocations on your screen by just adding a command line option. (didn't check this in yet!)

The TestPlugin code is in souceforge. Some code (related to help options) is still missing, need to add that later.

Read more

สกรัมเป็น Empirical process

สกรัมเป็น Empirical process

กระบวนการแก้ปัญหาในโลกแบ่งเป็น 2 แบบ แบบแรกคือ Defined process ซึ่งเป็นกระบวนการที่มีขั้นมีตอนชัดเจน เช่น Waterfall เป็นต้น ส่วนแบบที่สองคือ Empirical process หรือ "กระบวนการเชิงประจักษ์" ซึ่งเป็นการทำไปแล้วก็ปรับไปเรื่อย ๆ สกรัมเป็นแบบหลัง

By Chokchai
สกรัมมาสเตอร์ observe ผู้คน

สกรัมมาสเตอร์ observe ผู้คน

ครั้งที่แล้วผมแบ่งปันไปว่าสิ่งหนึ่งที่ผมตอนเป็นสกรัมมาสเตอร์มองหาคือ polarity หรือขั้วตรงข้าม ซึ่งคู่แรกที่ผมแบ่งปันไปคือ ระเบียบ (control) และความสร้างสรรค์ (creative) วันนี้ผมตะมาแบ่งปันอีกรูปแบบหนึ่งของ 2 ขั้วนี้ที่เรียกว่า survive (อยู่รอดปลอดภั

By Chokchai
สกรัมมาสเตอร์ observe polarity

สกรัมมาสเตอร์ observe polarity

polarity คืออะไร? สิ่งหนึ่งที่ผมในฐานะสกรัมมาสเตอร์จะ observe คือ polarity polarity คือขั้วตรงข้าม ดุจ แสงและเงา, centralized และ decentralized, creative และ control, competitive และ collaborative ทุกขั้วมีโอกาสจะเป็นทั้งข้อดีและเสีย อะไรที่มากเกินไปจะไม่ยั่งยืน การ observe polarity เหมือนมองลู

By Chokchai
ระเบียบ และ อิสรภาพ

ระเบียบ และ อิสรภาพ

พวกเราได้รับภาพนี้มาจากผู้มีพระคุณท่านหนึ่ง เธอแบ่งปันแรงบันดาลใจของภาพนี้ให้ผมทราบว่า ขวดแก้ว จากมุมของผู้ปกครองเป็นเหมือนกรอบที่วางเอาไว้เพื่อปกป้องหมีน้อยจากภยันตรายต่าง ๆ ภายนอก ขณะที่จากมุมของหมีน้อยมันเป็นเหมือนกรงขังไม่ให้เค้าออกไปโลดเล่นเก็บเกี่ยวประสบการณ์ ผมมองอิสรภาพและระเบี

By Chokchai