Does any one know of a gui interface for unit testing C++ code i.e a framework which will list all the classes and methods(like an IDE) and lets us invoke them on click of a button after input parameters are given through the gui.I searched online and the forums, but could not find any.
Visual Studio IDE is the obvious choice for Windows, although It is Microsoft, for learning how to make a GUI It's easy. Just wouldn't consider it for "serious" projects and cross-platform applications.
Is wxForge a plugin for code blocks? Also I do not want an IDE, I want a gui driven test framework. I mentioned IDE to indicate that it should list the methods like an IDE does. Please pardon and correct me if I missed something in your reply.
I would want it to run on linux as that is my development environment.
I find your question a bit unclear: do you mean a tool which parses your C++ source, lists all the classes, methods, etc, and then generates code to call all the methods? (on the click of a button).
Kind of :) May be its too much to ask for. It should give me hooks to call the methods like Junit and associate the ui button clicks to invoke the test methods. Right now I am thinking of designing UI using QT and write code to invoke my c++ methods. Any ideas???
Thank you Andy, I checked out qxcpp, but it seemed just automated running of all the methods. The main requirement is to have a gui to take the input the paramters to a method. The running of tests will not be automated, its a like a user manually testing a method through ui.
Ok, now I went ahead and created a qt based gui to test our api. The user sees a list of api methods, then he goes and clicks on a method he wants to test. A input page appears to take the input parameters, when user clicks submit,the click handler calls the api method and displays the output of the method. If it is a getMethod, displays what the get method retruned, if its a object, the I have a output page will display contents of the object.
Now the problem is this doesnot scale. Whenever api changes I have to change the input and output pages to reflect the change. Instead I want a c++ code generator that can create qt pages for me.
<?xml version="1.0"?>
<APIMethods>
<APIMethod name="multiply">
<input>
<label id="ilNum1" text="Num1: "/>
<Lineedit id="itNum1"/>
<label id="ilNum2" text="Num2: "/>
<Lineedit id="itNum2"/>
<button id="ibSubmit" text="Submit"/>
</input>
<output>
<lable id="olResult" text="Result: "/>
<Lineedit id="otResult"/>
<button id="obClose" text="Close"/>
</output>
<error>
<label id="olErrormessage"/>
</error>
</APIMethod>
</APIMethods>
The qt code looks like this:
The header file looks like this:
}
Is there a way I can use some tool to generate this code in header and cpp files given the above xml. I will still write the submit button handler code, but the task of layout and creating labels should be automated. Anyone know which tool could be used to do this job?
Sounds like a good possibility. I have done the same sort of thing using Python, but to generate console-based tests.
The header side of things is definitely possible. But I did have to provide code for some the test cases in the cpp file manually.
You might want to look into defining a test base class which sits between QWidget and the generated test class, to cut down on the amount of generated code. It might make sense to hide the Qt specifics from the test code, too.
I suppose that you want something for free? If you or your company is willing to pay, there are tools developed by parasoft and vector software that provide automated unit testing for C++.