Test Case Generator

Home Forums General Test Case Generator

This topic contains 10 replies, has 1 voice, and was last updated by Profile photo of Admin Admin 11 years, 10 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #1846
    Profile photo of Admin

    I am looking for an open source solution for a test case generator.
    The program needs to be able to generate <b>test cases</b> for small C programs (at the very least) with full branch coverage and statement coverage.
    I would appreciate any help from anyone!!!!

    I am attempting to write one of these myself and need all the help I can get. Having a functional model to work from would be very helpful.

    Profile photo of vheinitz

    Do you know the tool gcov on *nix? May be it is what you need for path-coverage
    testing. This doesnt require any source code modification.

    I registered on this site in the hope to find the same – Testcase generator.
    I am affraid, I must write it myself. Id appreciate any advise.

    Profile photo of HeretiCorp

    Sorry to hear you are faced with writing this program. We ended up having to write it ourselves and the results were mediocre.
    Just out of curiousity, what has compelled you to write a test case generator? I assume you have been tasked this for a class project.
    If you have further questions feel free to ask. I may be able to help.

    Profile photo of vheinitz

    No, it is not a class project. During last three years Ive been involved in a
    big project. It is industrial visualization with lots of components and a lot of
    properties per component.
    I implemented UnitTests for a few of them and it is awfull to write the testdata.
    It takes a lot of time.

    Then I written own UnitTest Classes, which read Testdata as a stream of chars,
    interprete it, and calls corresponding functions. e.g.:
    would mean: New test “STR_GW001”, Create Component, setProp Nr. 8 with “hello”
    assert, that property Nr. 442 is also “hello”

    That way it goes quicker and there is no need to recompile after changing the testdata.
    Now I need sth. to create such strings more comfortable from GUI.
    The requirenment is pretty specific, I know. But I thought, there could be a generic,
    customizable tool.

    What was your motivation for writing a generator, and why it wasnt succesfull?

    Profile photo of HeretiCorp

    The test case generator I wrote was for an undergrad software engineering class. The project was a success, but the end product was not very sophisticated.

    The function of the program was to actually read the source code of another program and generate variable values based on an analysis of the source code of the second program. It is easy to generate random values for variables but this is not very effective. Things become difficult when a variable?s value depends upon the value of other variables, etc. Conditional and control statements are difficult to deal with in this context as well. Our program was designed to achieve path coverage, full branch coverage, and multi-condition coverage. On a basic level branch coverage was achieved but multi condition coverage was abandoned due to time constraints (which basically means it was really freakin hard to do and we ran out of time).

    If your company will allow it, I would recommend looking for a commercial alternative to writing this software yourself. It took 4 programmers under the guidance of a PhD, who had done research on the subject, well over a month to come up with what we had. There was one other team of 4 programmers working on the same problem at the same time we were and they managed a slightly more polished product, but their program was still limited.

    ?if you are a good programmer and really know what you?re doing then you could probably pull off a utility tailored to your specific needs, but unfortunately there is no generic utility that I am aware of.

    This all gives me an idea though! This sort of program might make a great open source project!

    Profile photo of vheinitz

    You are right. I failed very often with projects which seamed to be small and
    simple, but turned out to be complicated.
    In this case I need really sth. easy. I have written this tool tonight. I guess it is
    sufficient for me. Ill see on Monday, if it is so.
    If you are interested in the idea (Programm intself is hardly usable be
    someone but my), I could give it to you. It requires Qt 3 for compiling.

    Have you used ready libraries in your project? I guess ctags and graphviz
    would be a help. And of cause the tool I already mentioned: gcov.
    In which language have you written this programm?

    So, did you derive your testdata from the datatypes/values within the if- and loop -conditions? It sounds really interesting.

    An open source project for testdata generation would be a great project indeen.
    If I find Time to make my programm more user friendly, I certainly publish it on

    Profile photo of HeretiCorp

    Yes, test cases were generated based on variable type and value within different loops and such. Its difficult to do because the current value of a variable you wish to use as a test case may only be able to obtain said value if other variables have certain values, or certain controll statements have been triggered.

    For the most part it was an interesting project. I can tell you that there were times when we werent sure if we could pull it off!

    By the way, how is it coming for you? Did the utility you made work out?

    Profile photo of HeretiCorp

    Oh, I forgot. We didnt use any libraries associated with test generation. Everything was written from scratch. We made use of the string and math libraries… and some other basic stuff. I was pretty happy with our parser. It could deal with any kind of comments, or any kind of funky code formatting. Even some stuff thats not supported in standard C (like C style comments within other C style comments). Thats kind of silly I know, but I had fun writing it.

    Profile photo of vheinitz

    I guess, I ment completely other tool. I ment an Test-Case assistant, not generator.
    I dont think that test-cases can be generated authomatically.

    My tool works for my requirenments well. I described it on my home-page:


    I think it is generic, flexible and language / unit test framework independent.

    Any comments are greatly appreciated :-)

    Profile photo of vheinitz

    Hello again.
    I think here is sth. similar to you tool but in Java. … #TestGen4J
    isnt it?

    Profile photo of david


    Im currently looking for software that could walk through flow charts listing out all possible routes and outcomes from the charts and thus generating the conditions for testing.

    I dont think that this would be impossible as Dia could produce the flow charts. Im told that Dia files are XML, so if some kind of formal language is created to describe the conditions, I probably could create the required dia XML diagram from it.

    The system under test has a considerable number of legacy flow charts (all in visio) but tables do exist which lists the conditions with the +ve and -ve jumps.

    Anyone any thoughts?



Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

New User?

Do NOT follow this link or you will be banned from the site!