Problem/Motivation

For whatever reason, practically the who test is hidden inside an assert so everything will report a pass or fail on line 51.

Proposed resolution

Trivial: don't call the method an assert. It is not.

CommentFileSizeAuthor
not_assert.patch951 byteschx

Comments

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix

It absolutely it is horrible. We have been starting to use it, in more and more places, without realizing that the line numbers spit out by \Drupal\simpletest\TestBase::getAssertionCall
makes things really hard, if you do that. In a world of data providers, we would have a data provider here.

Just in case someone is interested in data providers: theo.codes/php/improving-readability-of-phpunit-data-providers.html

alexpott’s picture

Title: EntityRevisionsTest is not debuggable » EntityRevisionsTest output makes it hard to discern what is causing the error
Status: Reviewed & tested by the community » Fixed

re #1 sometimes it is correct to use an assertTHING and sometimes it is not. Generally assertTHING functions should be very very short. This one is not and it should not be an assert.

Also EntityRevisionsTest is perfectly debuggable.

However even with this change the test output will still be hard to grok because all the asserts are inside nested loops so one fail on line 92 is not actually helpful either. IMO all of this is caused by our insistence of continuing to run a test method after the first failure - which is just nuts and makes things way harder than necessary.

Committed f7740e4 and pushed to 8.0.x. Thanks!

  • alexpott committed f7740e4 on 8.0.x
    Issue #2469507 by chx: EntityRevisionsTest output makes it hard to...
chx’s picture

> all of this is caused by our insistence of continuing to run a test method after the first failure - which is just nuts and makes things way harder than necessary.

run-tests.sh has a die-on-fail option which drupalci supports. I think getting a default on for this into the core testing suite given a core committers strong preference will be easy.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.