Re: question about document generation
"Baptiste Lepilleur" <[email protected]> Mon, 8 Sep 2003 21:51:53 +0200
| Newsgroups | gmane.comp.lib.cppunit.devel |
|---|---|
| Message-ID | <00d301c37642$a7970fc0$3c80c2d4@gaia> |
This is a multi-part message in MIME format. ------=_NextPart_000_00D0_01C37653.6A364310 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Create a singleton TestListener that collect the test description and = associates them to the test as they are run. Have it implements = XmlOutputterHook to add the test description to the XML output and = you're done. Then, in each test method, you need to call a method on your singleton = TestListener to set the test description. You could also also write a = new CPPUNIT_TEST macro that would take the description as a parameter = and wrap the 'setup' to set the test description. The first approach is easier to implement, but will not allow you to = associate the description to the test if setUp() fails, which the second = approach allow. Adding descriptive data to test is something I really want to do in = CppUnit V2. This includes, but is not limited to test description. When writing functional tests, it is often fairly useful to add some = other data to a test. Baptiste. PS: I'm also from Paris ;-) ----- Original Message -----=20 From: [email protected]=20 To: [email protected]=20 Cc: Patrice.STOESSEL-s/S/[email protected]=20 Sent: Sunday, September 07, 2003 7:04 PM Subject: [Cppunit-devel] question about document generation hello ! First of all, i want to congratulate you for CppUnit which is a great = product ! I am using it everyday (work days and weekends ! ;-) and spread it out = as much as i can ... Now, comes my question : I work in a company where paper and documentation is important :-\ I'll have to produce a document with the result of the test execution = produced by CppUnit. So, my objective is to produce the "test document" automatically with = CppUnit. The idea is the following : - to be able to associate a documentation (objective of the test, kind = of requirement, ...) with every test - to be able to run the tests as usual, recording success, failures = and errors - to collect, for every test, the documentation and the result of the = test. The documentation could be a simple std::string associated with a = test. The formatting part of the document shouldn't be a problem either. So the tricky part is to to be able to insert the documentation in = CppUnit framework. How would you do that ? I don't see how to do that without modifying the core of CppUnit. Do you think there is a simpler way ? Thanks in advance for your answer ...=20 Cheers from Paris (France, not Texas !) Patrice ------=_NextPart_000_00D0_01C37653.6A364310 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Create a singleton TestListener that = collect the=20 test description and associates them to the test as they are run. Have = it=20 implements XmlOutputterHook to add the test description to the XML = output and=20 you're done.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial = size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Then, in each test method, you need to = call a=20 method on your singleton TestListener to set the test description. You = could=20 also also write a new CPPUNIT_TEST macro that would take the = description as=20 a parameter and wrap the 'setup' to set the test = description.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>The first approach is easier to = implement, but will=20 not allow you to associate the description to the test if setUp() fails, = which=20 the second approach allow.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial = size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Adding descriptive data to test is = something I=20 really want to do in CppUnit V2. This includes, but is not limited to = test=20 description.</FONT></DIV> <DIV><FONT face=3DArial size=3D2> When writing functional tests, it = is often=20 fairly useful to add some other data to a test.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>Baptiste.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>PS: I'm also from Paris = ;-)</FONT></DIV> <BLOCKQUOTE=20 style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A [email protected] = href=3D"mailto:[email protected]">[email protected]</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20 title=3Dcppunit-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org=20 = href=3D"mailto:[email protected]">[email protected]= ourceforge.net</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20 title=3DPatrice.STOESSEL-s/S/[email protected]=20 = href=3D"mailto:Patrice.STOESSEL-s/S/[email protected]">[email protected]= halesgroup.com</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, September 07, = 2003 7:04=20 PM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Cppunit-devel] = question about=20 document generation</DIV> <DIV><BR></DIV><FONT face=3Darial,helvetica><FONT lang=3D1 = face=3DArial size=3D2=20 FAMILY=3D"SANSSERIF">hello !<BR><BR>First of all, i want to = congratulate you for=20 CppUnit which is a great product !<BR>I am using it everyday (work = days and=20 weekends ! ;-) and spread it out as much as i can ...<BR><BR>Now, = comes my=20 question :<BR><BR>I work in a company where paper and documentation is = important :-\<BR>I'll have to produce a document with the result of = the test=20 execution produced by CppUnit.<BR>So, my objective is to produce the = "test=20 document" automatically with CppUnit.<BR><BR>The idea is the following = :<BR>-=20 to be able to associate a documentation (objective of the test, kind = of=20 requirement, ...) with every test<BR>- to be able to run the tests as = usual,=20 recording success, failures and errors<BR>- to collect, for every = test, the=20 documentation and the result of the test.<BR><BR>The documentation = could be a=20 simple std::string associated with a test.<BR>The formatting part of = the=20 document shouldn't be a problem either.<BR>So the tricky part is to to = be able=20 to insert the documentation in CppUnit framework.<BR><BR><BR>How would = you do=20 that ?<BR>I don't see how to do that without modifying the core of=20 CppUnit.<BR>Do you think there is a simpler way ?<BR><BR><BR>Thanks in = advance=20 for your answer ... <BR><BR>Cheers from Paris (France, not Texas=20 !)<BR><BR> =20 Patrice<BR></BLOCKQUOTE></FONT></FONT></BODY></HTML> ------=_NextPart_000_00D0_01C37653.6A364310-- ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf