Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-11-18
10:57 • Ticket [c2f368c201] io-52.20.1 test failure status still Open with 3 other c... artifact: c53ad65c9d user: chrstphrchvz
2022-09-05
21:49 • Ticket [53cdb9696c] tcltest: how to mark tests as known/expected to fail without... artifact: 7e72109b89 user: chrstphrchvz
10:19 • Ticket [53cdb9696c]: 3 changes artifact: dd837cd8de user: sebres
01:08 • Ticket [53cdb9696c]: 3 changes artifact: 6774c5ce96 user: chrstphrchvz
2022-09-04
19:41 • Ticket [53cdb9696c]: 3 changes artifact: 89401c31de user: fvogel
2022-08-29
19:07 • Ticket [53cdb9696c]: 3 changes artifact: a969f00f71 user: fvogel
18:49 • New ticket [53cdb9696c]. artifact: 4eb2f2b89c user: chrstphrchvz

tcltest: how to mark tests as known/expected to fail without skipping?

Open53cdb9696c0be77ac7ea2ca1042f04b1e441b52dCreated 4 years agoUpdated 4 years ago
Descriptionwiki2022-08-29 18:49:56
A common feature of unit testing software is the ability to mark tests as currently known/expected to fail, while still allowing them to be run rather than completely skipped. I have not encountered this feature in the Tcl/Tk test suite, even though I think Tcl/Tk would find it useful; is this a limitation of tcltest? (If so, this ticket is an RFE.)

Of course, even with this feature, it would not help for tests which crash and bring down processes shared with other tests or the test harness itself.

Referenced by1
  • c53ad65c9dTicket [c2f368c201] io-52.20.1 test failure status still Open with 3 other changes ticket2023-11-18 10:57:09
fvogelwiki2022-08-29 19:07:37

IIUC what you are searching I think the answer is the 'knwonBug' constraint. The tcltest man page then suggests using

configure -constraints knownBug \
          -limitconstraints true \
          -verbose pass
to run exactly those tests that exercise known bugs, and discover whether any of them pass, indicating the bug had been fixed.

fvogelplain2022-09-04 19:41:34
Is my answer below ok for you? Can I close this ticket?
chrstphrchvzwiki2022-09-05 01:08:03

Thank you for pointing me to the knownBug constraint; I’m not inclined to say it completely achieves what I meant, however if the Tcl community finds it to be a satisfactory substitute, then this ticket should be closed rather than kept open as an RFE. What I had in mind would resemble things like ERT :expected-result :failed or Perl TODO or Qt Q_EXPECTFAIL(). The point of this feature would be for known/expected failing tests to run by default (without having to do anything like manually override constraints), and clearly indicate any tests which expectedly fail or unexpectedly pass.

sebresmarkdown2022-09-05 10:19:09

I also may not fully understand the concern of expected failure in test suite. Or either what exactly do you miss.

Isn't a test resulting with OK in error case a solution you're looking for?

    test set-without-args {must fail with wrong args ...} -body {
        ::set
    } -returnCodes error -match glob -result {wrong # args: *}
This test expects an error and would pass if body throws an error and the error message matches.

chrstphrchvzwiki2022-09-05 21:49:50

No, writing a test which should generate an error in the absence of an issue is not the same marking a test as known/expected fail in the presence of an unresolved issue. The contents of a test are code which should pass if there are no unresolved issues. Known/expected fail is metadata which only the test harness should know about, not the code within the test; the results from a test harness should use this metadata to distinguish tests which expectedly fail/unexpectedly pass from tests in the existing pass/fail/skip categories.

The idea is that under a workflow resembling test-driven development, when an issue (bug or missing feature) is noticed, a test is created for it which initially fails, and is marked as known/expected to fail (especially when a solution is not expected right away). But the test should always run by default and report whether it fails as expected or passes unexpectedly; short of something like uncontained crashes, there should be no reason to skip it by default. If a release is made before the solution is implemented, then it is clear to anyone running the default test suite that the maintainer is already aware that there are known/expected failing tests for issues which have yet to be addressed in a release. When the solution is implemented, the test is kept and marked as expected to pass.

Log in (anonymous is fine) to add a comment.