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

Conversation

@epdenouden
Copy link
Collaborator

@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 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.

Loading

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Dec 7, 2018

Wow! :-)

Loading

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Dec 7, 2018

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

Loading

@epdenouden epdenouden force-pushed the improved-testdox branch from 5724c7e to 99acf08 Dec 7, 2018
@epdenouden
Copy link
Collaborator Author

@epdenouden epdenouden commented Dec 10, 2018

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

Loading

@epdenouden epdenouden force-pushed the improved-testdox branch from 6910648 to 9d63862 Dec 10, 2018
@epdenouden epdenouden changed the base branch from 7.5 to master Dec 10, 2018
@epdenouden epdenouden changed the title WIP TestDox colorization TestDox colorization Dec 10, 2018
@epdenouden
Copy link
Collaborator Author

@epdenouden 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. :)

Loading

@epdenouden
Copy link
Collaborator Author

@epdenouden epdenouden commented Dec 15, 2018

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

Loading

@epdenouden epdenouden force-pushed the improved-testdox branch 2 times, most recently from ca71d8b to 53c3058 Dec 18, 2018
@epdenouden epdenouden force-pushed the improved-testdox branch from 53c3058 to a3aaef8 Dec 18, 2018
@epdenouden epdenouden force-pushed the improved-testdox branch from e26122f to aa9b8ed Dec 20, 2018
@epdenouden epdenouden force-pushed the improved-testdox branch from 6bafc8d to 811da6f Dec 20, 2018
@epdenouden
Copy link
Collaborator Author

@epdenouden epdenouden commented Dec 24, 2018

🎄 🎁

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

Loading

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Dec 24, 2018

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

Loading

@epdenouden
Copy link
Collaborator Author

@epdenouden epdenouden commented Dec 24, 2018

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.

Loading

@sebastianbergmann sebastianbergmann merged commit df0e66c into sebastianbergmann:master Dec 24, 2018
4 checks passed
Loading
@epdenouden epdenouden deleted the improved-testdox branch Jan 7, 2019
@epdenouden epdenouden mentioned this pull request Feb 28, 2019
@rpkamp
Copy link
Contributor

@rpkamp rpkamp commented Mar 4, 2019

This looks awesome, @epdenouden! Nice work 🙂

Loading

@epdenouden
Copy link
Collaborator Author

@epdenouden epdenouden commented Mar 4, 2019

@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.

Loading

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

Successfully merging this pull request may close these issues.

None yet

3 participants