Implement expected failures for CppUnit
sbergman at redhat.com
Wed Oct 7 05:26:19 PDT 2015
On 10/07/2015 02:11 PM, Jan-Marek Glogowski wrote:
> Am 07.10.2015 um 12:47 schrieb Stephan Bergmann:
>> On 10/07/2015 11:37 AM, Jan-Marek Glogowski wrote:
>>> I've implemented CPPUNIT_TEST_XFAIL to add test cases to a suite, which
>>> are expected to fail.
>> Do you have some explanation what this is good for? (My assumption is
>> that one would just write the test code in a way that it is supposed to
> The idea discussed in ESC was to allow developers to write tests for
> bugs, even if they are not able to fix them. We also assumed / hoped
> it's easier to write a test then fixing a bug. We'll see, if this turns
> out to be true.
Ah, yeah, I vaguely remember. So lets see...
> Most times this feature is used for test driven development, where you
> mark tests as expected to fail without breaking the build and when you
> actually fix the bug you simply remove the XFAIL from the test case. The
> idea is to prove you wrote a test for your bugfix.
I think this is misguided. In TDD, you want to be sure that your test
is actually run. The easiest way to do that is to initially make the
test fail, and see that "make" fails due to your broken test. (How many
times did static code analysis turn up well-intended test code that had
never been run, because the author had forgotten some of the boilerplate
to wire it up in the test framework, and had failed to write an initial
version of the test that would have failed.) You then code away until
your test succeeds, at which point you commit.
More information about the LibreOffice