10

Is there any automatic unit test case generator available for C language in Eclipse/ Netbeans or visual studio?

Generator in the sense, if I give a file it should generate unit test cases for all the functions. (like jUnit maker in Netbeans).

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Harikrishnan
  • 3,664
  • 7
  • 48
  • 77
  • 1
    I believe that the most common approach is to use a C++ unit testing framework. Trying to write test cases in C would just be horrid. – David Heffernan Nov 21 '11 at 14:16
  • 1
    I'd question the usefulness of "automatically generated tests". – Noufal Ibrahim Nov 21 '11 at 14:17
  • The use of automatic generated tests is to reduce the time required to unit test a module. – Harikrishnan Nov 21 '11 at 14:19
  • 2
    @Noufal That just saves you the tedium of writing the boilerplate. But I agree, the time consuming bit is writing the meat of the test. Automatically generating the boiler-plate probably saves ~2% of the time. – David Heffernan Nov 21 '11 at 14:20
  • Ah. I didn't notice that it was a Java thing which he used as an example. I dislike code generators in general and the Java world seems to overuse that kind of thing heavily. – Noufal Ibrahim Nov 21 '11 at 14:33
  • this is still an important question, but moderator seems to like writing the c++ unit test manually... – user2846246 Oct 21 '15 at 07:26

2 Answers2

6

If you want a tight integration in Eclipse, you should take a look at CUTE. It is a C++ Unit testing framework, but it is generally not so much of an effort to make C code comply to C++ compilation, and you get access to more inspection tools like this one.

You can take a look at a list of C Unit Testing framework and C++ Unit testing framework, but I don't know of any as much integrated in Eclipse as CUTE is. (But Eclipse is open source, and nothing stops you from creating a plug-in for another unit test framework :) )

Matthieu
  • 4,605
  • 4
  • 40
  • 60
3

There is a whole bunch of different C Unit test frameworks.
Following are free ones that has generators:

Izzy
  • 402
  • 6
  • 16
Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95