When running tests from the command line, I currently have two options:
a) I can pass --verbose, in which case I get a really long list of mostly irrelevant passing tests that I have to scroll back through to check if anything failed; or
b) I can not pass --verbose, in which case if anything fails I need to re-run the test to find out what it was.

The vast majority of the time when I'm running a test I just want to know that everything passed, or if not then what I need to do to fix it. I propose listing all failed tests and exceptions by default, and adding a --summary-only option to support the current behaviour.

I wonder if this will confuse the d.o test infrastructure?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ianthomas_uk’s picture

Reroll, plus a version with a deliberate mistake to show this doesn't break d.o's test infrastructure (it shouldn't, as it doesn't change the behaviour of the --verbose flag)

sun’s picture

I've read the issue summary at least twice in the meantime, but I still do not understand what the problem and goal is... :-/ Can you clarify the summary?

The last submitted patch, 1: drupal-2200747-run-tests-show-errors-1-will-fail.patch, failed testing.

ianthomas_uk’s picture

Basically I don't find the current default output useful if a test fails, but the verbose output can get very long so isn't easy to read and doesn't give you any extra useful information if all tests pass.

This is an attempt to find a compromise between the two. It's still easy to read, but if a test fails it will tell you what (which is often enough, e.g. if it's a failure you've seen before, or is a test you were working on).

sun’s picture

Title: Make runtests.sh list failing tests by default » Make run-tests.sh show verbose output for failing assertions only
Issue tags: +Testing system, +DX (Developer Experience)

Note that we cannot change the default output of run-tests.sh, because that would affect the regular Review log of PIFR and testbots, too:

https://qa.drupal.org/pifr/test/748038#footer (expand the "Review log" fieldset)

The review log is big enough already now — it has to be transferred between the testbot and qa.drupal.org (in addition to the assertion result rows).

In other words, this will need a new flag/argument to run-tests.sh.


Aside from that, we can happily rethink the CLI --verbose output. This flag/option is not used by PIFR/testbots.

We might want to take inspiration from PHPUnit's output in case of a test failure. Our current ASCII table output is certainly very limiting.

That said, given how our (web) tests are designed, it is often helpful to see some level of context before a failing assertion (e.g., 3-6 pass/info messages), so as to better understand what happened before a failing assertion.

ianthomas_uk’s picture

Ah, ok. I thought the testbots were already using --verbose, because they get the assertion-level detail. If they are getting that by other means and log size is an issue then do we even want to be logging the test summary, which runs to several pages?

this will need a new flag/argument to run-tests.sh

I'd say the default behaviour should be the one most useful for humans. If test bot wants a different output, then it should be fairly easy to get testbot to pass the extra flag(s).

I didn't want to reduce the verbose output in case the full log is sometimes useful, as there would be no way of getting that. Yes, a few messages before the failure are often useful, but I didn't want to make the default output too noisy. I'm not particularly familiar with PHPUnit's output, so I'm not sure what we'd be getting inspiration from.

cilefen’s picture

What about --verbose (would be verbose on failures only) and in addition --debug, which would be verbose also on passing tests?

texas-bronius’s picture

I have been wanting this for some time, too: Running tests from command line in TDD, it's useful to see "All green!" or any exceptions and errors, but it is burdensome to see a sea of green and have to scroll back to see *whether* anything failed. Maybe if modifying --verbose is too risky, could we consider introducing a flag that means "--errors-and-exceptions" so like "--only-issues" or "--show-issues" might work?

Another idea which I think would also work is a way, from command line, to go back and list previous test outcomes. I guess this would involve storage somewhere: run tests as non-verbose, see a failure, then issue a followup command "show me the last test results details" which would then list either only failures or all, as if it were just run but with --verbose.

-Bronius

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

texas-bronius’s picture

A related tip that helps me: In mac Terminal (and there must be an equiv in Linux?), after a test is run, you can hit Command+UP_ARROW to jump to the previous prompt in scrollback which, when hit just once, takes you right to where you issued the `run-tests.sh` command and can therefore see the time it took, summary line with Successes and Fails, etc. There's no need to "return" to the original, latest prompt, bc your cursor is really still there-- just hit UP_ARROW to repeat the previous command and run the test again (or whatever your next thing is).
-Bronius

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
160 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.