Colorful diff for test failures with database checks #56788
Unanswered
simonschaufi
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Instead of the plaintext result of a similar result from the database, I came up with the idea of actually creating a diff that is colorful and immediately shows me what is wrong instead of manually comparing the similar result with my expected one.
Here is an example output:
There was 1 failure: 1) Vendor\Package\Tests\Functional\Controller\Api\ArticleNumberApiControllerTest::generateArticleNumberAction Failed asserting that a row in the table [tx_package_domain_model_article] matches the attributes: { "article_number": "260278Q962", "bezeichnung": "Gabel iso M4 auf 1,6mm gedr. Buchse, 0,50m", "bezeichnung_en": "Gabel iso M4 on 1,6mm gedr. Buchse, 0,50m", "bezeichnung_fr": "Gabel iso M4 sur 1,6mm gedr. Buchse, 0,50m", "bezeichnung_es": "Gabel iso M4 a 1,6mm gedr. Buchse, 0,50m", "zusatz": "Konfektioniertes Kabel mit 0,5mm², H05V-K, rot", "zusatz_en": "Assembled cable with 0,5mm², H05V-K, rojo", "zusatz_fr": "Câble confectionné avec 0,5mm², H05V-K, rojo", "zusatz_es": "Cable confeccionado con 0,5mm², H05V-K, rojo", "lang_text": "Hersteller Steckerverbinder: ---\/MURRELEKTRONIK\nKabel: geprüft", "lang_text_en": "Manufacturer Connectors: ---\/MURRELEKTRONIK\nCable: tested", "lang_text_fr": "Fabricant des connecteurs: ---\/MURRELEKTRONIK\nCâble: testé", "lang_text_es": "Fabricante de los conectores: ---\/MURRELEKTRONIK\nCable: probado" } Found some similar results that didn't match exactly: --- Diff for result #1 of table tx_package_domain_model_article --- ---------- begin diff ---------- @@ @@ { "article_number": "260278Q962", "bezeichnung": "Gabel iso M4 auf 1,6mm gedr. Buchse, 0,50m", - "bezeichnung_en": "Gabel iso M4 on 1,6mm gedr. Buchse, 0,50m", - "bezeichnung_fr": "Gabel iso M4 sur 1,6mm gedr. Buchse, 0,50m", - "bezeichnung_es": "Gabel iso M4 a 1,6mm gedr. Buchse, 0,50m", + "bezeichnung_en": "Forked ins M4 on 1,6mm turned socket, 0,50m", + "bezeichnung_fr": "Fourche isolé M4 sur 1,6mm contact à sertir déc. (f), 0,50m", + "bezeichnung_es": "Ahorquillado aislado M4 a 1,6mm contacto girado hembra, 0,50m", "zusatz": "Konfektioniertes Kabel mit 0,5mm², H05V-K, rot", - "zusatz_en": "Assembled cable with 0,5mm², H05V-K, rojo", - "zusatz_fr": "Câble confectionné avec 0,5mm², H05V-K, rojo", + "zusatz_en": "Assembled cable with 0,5mm², H05V-K, red", + "zusatz_fr": "Câble confectionné avec 0,5mm², H05V-K, rouge", "zusatz_es": "Cable confeccionado con 0,5mm², H05V-K, rojo", ----------- end diff ----------- .Would you welcome such an improvement? I have integrated the differ from https://github.com/sebastianbergmann/diff
Beta Was this translation helpful? Give feedback.
All reactions