Recently I implemented CppUTest framework on our projects. Projects are for TI platform running on CCSv6 IDE. This is my first touch with it and TDD either. I learned from Mr's. Grenning book Test-Driven Development for Embedded C. Thus, after setting up CCSv6 for CppUTest framework (followed installation manual on eclipse from CppUTest official site, as CCS is based on Eclipse), several compile-time and linker crashes and some project modification. I was successful and finally got our project under CppUTest unity testing. Everything works fine, but on small problem.
If I have more test groups let's say "SciaDriver", "ScibDriver" and "GpioDriver" (they are somehow related to each other, that's reason I left them in on file) under one .cpp file like this:
TEST_GROUP(SciaDriver)
{
void setup()
{
resetSCI(&SciaRegs);
}
void teardown()
{
}
};
TEST_GROUP(ScibDriver)
{
void setup()
{
resetSCI(&ScibRegs);
}
void teardown()
{
}
};
TEST_GROUP(GpioDriver)
{
void setup()
{
resetGPIO(&GpioCtrlRegs);
}
void teardown()
{
}
};
and in AllTests.cpp (or in AllTests.h included in AllTests.cpp) I try to import one of the group let's "ScibDriver" through IMPORT_TEST_GROUP(ScibDriver) all of the test cases run execution even those test cases for SciaDriver and GpioDriver group. Is it because they are all in on object file?
Yes, if I import test group which is completely in stand-alone source file, running tests behaves according to whether I IMPORT_TEST_GROUP(singleTestGroupInFile) or not.
Thank you for advice ;)
Regards
Martin
Hi Martin
TESTs and TEST_GROUPs self-install if they are in the build. If you put tests into a library, IMPORT_TEST_GROUP will cause the test group's .o file to be pulled from the library. All TESTs in a file will be installed into the list of all tests.
You can selectively run tests by command line switches (see cpputest.org)
If you do not want all the test groups in a file in the build you need to have them in separate files.
Cheers, James
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
--
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/5f43dc51-7ce5-4087-befc-8032998f2477%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to cppu...@googlegroups.com.
Hi Martin
You may find some of the articles on this page useful https://wingman-sw.com/articles/tdd-legacy-c
The first few articles under the "ROAD BLOCKS" section were probably about TI dependent code.
Passing volatile variables to CppUTest, (casting away volatile) is not a problem. I cannot think if a case where it would matter.
HTH, James
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/008bd9fb-2a26-4944-844e-4c2f14d62fce%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cpputest/07620374-d52a-4ba0-8a10-a458c2a907den%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cpputest/tencent_19652827B01BEB4F72EB3FFE51FFCE77E505%40qq.com.