Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestDox colorization #3439

Merged
merged 51 commits into from Dec 24, 2018
Merged

TestDox colorization #3439

merged 51 commits into from Dec 24, 2018

Conversation

epdenouden
Copy link
Contributor

@epdenouden epdenouden commented Dec 7, 2018

While working on the buffered TestDox printer I found the output format really useful for work on the terminal. Adding some color highlighting and removing clutter gives it a completely different look. It's much easier to spot when something needs attention.

Changes

Basic handling of ANSI colors gets its own helper class until we migrate over to a better CLI/console library. Its own test suite gives a quick demo of most features:

image

  • mark changes in TestSuite by underlining the class name or class @testdox-annotation
  • when verbose the test duration mirrors the status color
  • reduced typographic clutter when using color
  • @dataprovider parameter values used in @testdox are highlighted
  • @testdox has access to the name of the @dataprovider-row via $_dataName
  • show whitespace using dimmed interpuncts
  • improved visualization for support for @dataprovider without @testdox

image

  • mirror test status colors in exception/error messages
  • use dimmed colors to make PHPT path and filenames easier to read
  • use dimmed colors to draw attention to changes in PHPT working directory
  • highlighted stacktraces: changes in path+file, line numbers

image

The CLITestDoxPrinter has been cleaned up further. It has given me fresh ideas for the TestListener rewrite and cleaning up the pile of slow end-to-end tests. I'll be creating issues with proposed practical solutions for this. This has been a nice warming up for working on a new implementation for the test result event system.

Any remarks or ideas are very welcome as always.

@codecov
Copy link

codecov bot commented Dec 7, 2018

Codecov Report

Merging #3439 into master will increase coverage by 0.41%.
The diff coverage is 89.83%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3439      +/-   ##
============================================
+ Coverage     82.15%   82.57%   +0.41%     
- Complexity     3580     3604      +24     
============================================
  Files           143      144       +1     
  Lines          9398     9405       +7     
============================================
+ Hits           7721     7766      +45     
+ Misses         1677     1639      -38
Impacted Files Coverage Δ Complexity Δ
src/Util/TestDox/Color.php 100% <100%> (ø) 16 <16> (?)
src/TextUI/ResultPrinter.php 97.27% <100%> (-0.07%) 78 <0> (-1)
src/Util/TestDox/TestDoxPrinter.php 82.85% <82.85%> (ø) 47 <47> (?)
src/Util/TestDox/CliTestDoxPrinter.php 94.31% <93.5%> (-0.63%) 39 <35> (-23)
src/Util/TestDox/NamePrettifier.php 95.04% <94.73%> (-3.75%) 47 <4> (+8)
src/TextUI/Command.php 71.23% <0%> (-0.18%) 208% <0%> (ø)
src/Framework/TestCase.php 75.83% <0%> (+0.24%) 304% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6d9814...ae1cb17. Read the comment docs.

@sebastianbergmann
Copy link
Owner

Wow! :-)

@sebastianbergmann
Copy link
Owner

Please change the target from 7.5 to master (7.5.0 was released today). Thanks!

@epdenouden
Copy link
Contributor Author

No problem, will rebase on master when I'm done with the finishing touches. :)

@epdenouden epdenouden changed the base branch from 7.5 to master December 10, 2018 16:01
@epdenouden epdenouden changed the title WIP TestDox colorization TestDox colorization Dec 10, 2018
@epdenouden
Copy link
Contributor Author

epdenouden commented Dec 11, 2018

@sebastianbergmann I have rebased it on master and all looks fine. If you are happy with it you can merge it in its current state.

The ongoing small improvements can go in a future pull request together with other housekeeping. I have a small list of nice-to-haves. Let me know if you have any requests. :)

@epdenouden
Copy link
Contributor Author

@sebastianbergmann I think I'm done with this (for now ;-) and get working on the general event/listener improvements.

@epdenouden
Copy link
Contributor Author

🎄 🎁

@sebastianbergmann I'm going to continue my test suite related housekeeping on #3453 before this pull gets too big.

@sebastianbergmann
Copy link
Owner

Is this ready to be merged or should it wait for #3453?

@epdenouden
Copy link
Contributor Author

It's ready to be merged. I have only been adding little improvements, while keeping everything stable. :-)

Still have some ideas like colorized help and --list* options. I will make those seperate pull requests when done.

@sebastianbergmann sebastianbergmann merged commit df0e66c into sebastianbergmann:master Dec 24, 2018
@epdenouden epdenouden deleted the improved-testdox branch January 7, 2019 10:15
@epdenouden epdenouden mentioned this pull request Feb 28, 2019
@rpkamp
Copy link
Contributor

rpkamp commented Mar 4, 2019

This looks awesome, @epdenouden! Nice work 🙂

@epdenouden
Copy link
Contributor Author

@rpkamp Thanks! It is nice to hear people enjoy using the stuff I enjoy making. 🍰 If you have any wishes or ideas let me know, I do intend to keep improving the various output formats incrementally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants