Boost.Test XML Output formatter generates Invalid XML file.

Hi, I have written my own struct to customize logging from struct "boost::unit_test::output::xml_log_formatter" However, the XML file generated by log Formatter is Invalid. it adds invalid node end = ">" , by the end of each test case logging. Please check below XML. <TestLog> <TestSuite name="Master Test Suite"> <TestSuite name="test_suite1"> <TestSuite name="MarketDataMasterTestSuite"> <TestSuite name="PostMarketData"> <TestSuite name="CTA"> <TestCase name="LevelOneData">error #LevelOneData#LevelOneData#STOCK$121@4106!132^SYMBOL&C#CLS_PRC_TD#0#NA> <TestingTime>16000</TestingTime> </TestCase> <TestCase name="LevelOneData">error #LevelOneData#LevelOneData#STOCK$121@4106!132^SYMBOL&CHL#CLS_PRC_TD#0#NA><TestingTime>0</TestingTime> </TestCase> </TestSuite> </TestSuite> </TestSuite> </TestSuite> </TestSuite> </TestLog> Has anyone faced scenario like this earlier?? Please let me know how to resolve this. Thank You, Gaurav This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and affiliates. This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. Please refer to http://www.jpmorgan.com/pages/disclosures for disclosures relating to European legal entities.

Does Boost.Test have any way to report coverage statistics? I have a requirement to provide coverage statistics for the code I am testing. Thanks, Herb Miller

Hi!
Unfortunately not. You can use either gcov or BullseyeCoverage to measure
coverage.
With Kind Regards,
Ovanes
On Wed, Jun 9, 2010 at 2:40 PM,
Does Boost.Test have any way to report coverage statistics? I have a requirement to provide coverage statistics for the code I am testing. Thanks, Herb Miller

Thanks. I will look into those tools.
Herb Miller
Quoting "Ovanes Markarian"
Hi!
Unfortunately not. You can use either gcov or BullseyeCoverage to measure coverage.
With Kind Regards, Ovanes
On Wed, Jun 9, 2010 at 2:40 PM,
wrote: Does Boost.Test have any way to report coverage statistics? I have a requirement to provide coverage statistics for the code I am testing. Thanks, Herb Miller

I am testing class A. However, class A makes some calls to class B. Does Boost.Test provide any "test harness" capability so that the responses from class B can be canned. I really only want to test class A, not A and B together. I hope the question makes sense. Thanks, Herb Miller

I am testing class A. However, class A makes some calls to class B. Does Boost.Test provide any "test harness" capability so that the responses from class B can be canned. I really only want to test class A, not A and B together. I hope the question makes sense.
You need to implement stub for the class B. If you have known interface it's pretty easy to prepare stub with pre-canned responses. Gennadiy

[Please do not mail me a copy of your followup] boost-users@lists.boost.org spake the secret code <20100609080130.21006u389wm3wotm@webmail.hiwaay.net> thusly:
I am testing class A. However, class A makes some calls to class B. Does Boost.Test provide any "test harness" capability so that the responses from class B can be canned. I really only want to test class A, not A and B together. I hope the question makes sense.
You need to decouple the classes somehow. The easiest way is to use an interface to separate them, in C++ terms a pure virtual base class for B. In my 5-part tutorial on using Boost.Test, you can see the use of an interface to decouple a class from its collaborator in part 4. http://legalizeadulthood.wordpress.com/2009/07/05/c-unit-tests-with-boost-te... There are lots of ways to decouple two collaborators, but I like "Extract Interface" the best. If for some reason your code is too performance sensitive for an interface sitting in the middle, you can decouple the collaborators with templates. I give an example of how to decouple your code from the Win32 API using templates here: http://legalizeadulthood.wordpress.com/2007/12/17/faking-out-the-win32-api-w... The book "Working Effectively With Legacy Code" provides lots of good ideas on how to decouple your system under test from its dependencies. I wrote a review of it here: http://legalizeadulthood.wordpress.com/2007/04/11/working-effectively-with-l... -- "The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/ Legalize Adulthood! http://legalizeadulthood.wordpress.com

Gaurav N Shah
Hi,
I have written my own struct to customize logging from struct "boost::unit_test::output::xml_log_formatter"
However, the XML file generated by log Formatter is Invalid. it adds invalid node end = ">" , by the end of each test case logging.
Is it possible your formatter does this? How your struct customizes xml_log_formatter? It does not really have any means of customization. Did you inherit from it? Gennadiy

I haven't seen that, but I have seen a '\0' passed into an assertion
ending up in the XML as-is. I don't even know if that's valid XML or
not, but Hudson's XUnit plugin cannot handle it. Of course I could get
around it, but would it be reasonable to request that the default
behavior of that formatter be to show the hex codepoint or something
rather than the character itself for those characters that are iscntrl
or some such?
On Wed, Jun 9, 2010 at 2:26 PM, Gennadiy Rozental
Gaurav N Shah
writes: Hi,
I have written my own struct to customize logging from struct "boost::unit_test::output::xml_log_formatter"
However, the XML file generated by log Formatter is Invalid. it adds invalid node end = ">" , by the end of each test case logging.
Is it possible your formatter does this?
How your struct customizes xml_log_formatter? It does not really have any means of customization. Did you inherit from it?
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (6)
-
Gaurav N Shah
-
Gennadiy Rozental
-
hmiller@hiwaay.net
-
John B. Turpish
-
legalize+jeeves@mail.xmission.com
-
Ovanes Markarian