Hello,
I'm currently writing a UnitTest plugin based on UnitTest++. There are already means to execute unit tests by adding them as a post build command.
While this works fine most of the time, I was still unsatisfied with it.
The motivation was to start unit tests from the IDE, like, for example JUnit or VS are doing it. Basically, right-click into the editor "UnitTest" -> "Run current test" or "Run current test suite".
It's meant to work like this when it's done:
The user creates a Test Project. This test project has a predefined main.cpp, which parses command line options and then runs tests based on the input from the command line.
This main.cpp is not meant to be manipulated (but can be nevertheless ofc).
Then you only have to add new files with tests and test suites a la UnitTest++. You can either run them all at once (simply build & run the project), or you can run them selectively from codeblocks.
I also want some kind of test list, where you can see what tests or suites there are and then run them from there. I'm basically thinking of something similar to the VisualStudio 2010 interface.
I've been using UnitTest++ for quite some time now and I've made a few adjustments to it over time, in order to report better error messages, more means for checking values or for comparing stl containers.
What I got to work so far:
- RMB -> Unit Testing -> Run Test
- RMB -> Unit Testing -> Run Suite
- RMB -> Unit Testing -> Run All Tests
- Running tests compiles the test program first
- Test output gets displayed & parsed by the plugin (similar to compilation output)
- Double click on a test failure jumps to the file + line where it failed
What's still to do:
- Logging of test results
- List containing all tests of one or more projects
- List with failed or successful tests
- Code Coverage (gcov)
- Comfort functions like 'create a new test file'
- Polishing
Screenshots so far:
http://i.imgur.com/zhuYek7.pnghttp://i.imgur.com/Ecytzof.pnghttp://i.imgur.com/gNXcGya.pngMy biggest concern is, that the plugin requires the adjusted version of the UnitTest++ framework, because a test project of the plugin must be based on the UnitTest++ framework. Otherwise the plugin can't parse the Tests and Suites or the output.
Would it work if the plugin simply creates a test project that already contains, say, 25 files (== the UnitTest++ files)?
I'd be happy to hear what you think.
Edit: Attached source.