Boost C++ Libraries: Ticket #7410: Test Units (Cases and Suites) in Boost.Test do not capture __FILE__ and __LINE__ at declaration point making it impossible to provide source file linking using external test management tools https://svn.boost.org/trac10/ticket/7410 <p> We currently use <a class="ext-link" href="http://bitten.edgewall.org/"><span class="icon">​</span>Bitten</a> as our continuous integration tool. We also use Boost.Test for all our unit tests. As Bitten integrates with <a class="ext-link" href="http://trac.edgewall.org/"><span class="icon">​</span>Trac</a>, which also provides the ability to browse our source repository, we want to be able to augment our test reports with links from test cases back to the source they appear in. In order to provide this capability we need to patch boost test so that <span class="underline">FILE</span> and <span class="underline">LINE</span> are captured in the test case and test suite macros. The patch attached to this ticket adds this capability. </p> <p> Once this information is available it becomes easy to extract this information from the test output. We use human readable output but this works equally well with the XML output. </p> <p> This can then be used by any number of continuous integration tools to provide much better test reports. In our case we turn each test case and test suite name into a link directly to the file and line in our source tree where the test unit was defined. This makes linking reports to actual source much more intuitive. </p> <p> This is a relatively simple patch and I have another follow on patch that further enhances the reporting capability of Boost.Test with a view to easier integration to third party tools. I'll comment back with the ticket number when it is created. We currently use a similar patch to the attached with our development code with boost 1.48. The attached patch is against trunk. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7410 Trac 1.4.3 Jamie Allsop <ja11sop@…> Sat, 22 Sep 2012 22:06:38 GMT attachment set https://svn.boost.org/trac10/ticket/7410 https://svn.boost.org/trac10/ticket/7410 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_test_test_unit_file_and_line.diff</span> </li> </ul> <p> boost_test_test_unit_file_and_line.diff </p> Ticket Jamie Allsop <ja11sop@…> Mon, 24 Sep 2012 16:02:58 GMT <link>https://svn.boost.org/trac10/ticket/7410#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7410#comment:1</guid> <description> <p> These patches, attached to: </p> <p> </p><div><dl class="wiki compact"><dt><a class="closed" href="/trac10/ticket/7397" title="Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class">#7397</a></dt><dd>Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class</dd><dt><a class="closed" href="/trac10/ticket/7410" title="Test Units (Cases and Suites) in Boost.Test do not capture __FILE__ ...">#7410</a></dt><dd>Test Units (Cases and Suites) in Boost.Test do not capture __FILE__ and __LINE__ at declaration point making it impossible to provide source file linking using external test management tools</dd><dt><a class="new" href="/trac10/ticket/7417" title="Detailed test status is not available in the Boost.Test log (status, ...">#7417</a></dt><dd>Detailed test status is not available in the Boost.Test log (status, assertions, passed) and so live test case status cannot be tracked</dd></dl></div><p> </p> <p> ...taken together allow for sophisticated test tools to be built on top of the Boost.Test output. </p> </description> <category>Ticket</category> </item> <item> <author>jaredgrubb@…</author> <pubDate>Wed, 26 Sep 2012 04:14:26 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7410#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7410#comment:2</guid> <description> <p> The patch looks reasonable. My only comment is that it changes the test_case constructor, which could cause migration issues for anyone that may have subclassed or written other macros. Might be better to keep the original constructor around and just fill in some dummy values for file/line if that happens to get called. </p> </description> <category>Ticket</category> </item> <item> <author>Jamie Allsop <ja11sop@…></author> <pubDate>Wed, 26 Sep 2012 12:19:56 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7410#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7410#comment:3</guid> <description> <p> Actually that's a good point - some sort of dummy values would probably work well. The call to the creation of the Master Test Suite could then either use that constructor or actually be created using <code>__FILE__</code> and <code>__LINE__</code> since technically that <em>is</em> where the master test suite is created. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gennadiy Rozental</dc:creator> <pubDate>Mon, 05 Nov 2012 11:37:00 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7410#comment:4 https://svn.boost.org/trac10/ticket/7410#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Applied in trunk with some modifications. Thank you for the submission </p> Ticket Raffi Enficiaud Tue, 07 Jul 2015 08:32:25 GMT milestone changed https://svn.boost.org/trac10/ticket/7410#comment:5 https://svn.boost.org/trac10/ticket/7410#comment:5 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> </ul> Ticket