apple / pkl

A configuration as code language with rich validation and tooling.
https://pkl-lang.org
Apache License 2.0
9.85k stars 258 forks source link

Improve testing with stats and errors per test section #498

Open jjmaestro opened 1 month ago

jjmaestro commented 1 month ago

Add some basic test stats to the test runner output for both SimpleReport and JUnitReport:

bioball commented 1 month ago

Thanks for the PR! FYI: I probably won't get around to reviewing this until after our 0.26 release is out in early June.

jjmaestro commented 1 month ago

@bioball no worries! I actually submitted the PR too early :S I'm re-doing it all because (1) I didn't realize I had a bunch of tests failing and (2) the failures and other stuff made me re-think it all.

I'm currently thinking about how to best approach things... I might close the PR and re-open a new one once I have something that 100% works. E.g. I thought I was going to be able to change some of the XML format, thinking it was a bit freeform and I'm now learning about the different XML schemas for unit testing 😅 Still not sure which one Pkl is using and/or if I can change it to add more of the information I'd like to have, etc.

Anyway, TL;DR no rush :) Thanks!!

jjmaestro commented 1 month ago

OK, I think I finally got it done :) I've refactored a bunch of stuff and fixed my original commit, here's the summary:

Here's some outputs that show these new features:

jjmaestro commented 1 month ago

Ah, so I don't forget... I've been trying to find out if there's an XSD to validate the XML produced by JUnitReport and I eventually found Jenkins' xUnit plugin that lists a bunch of supported tools. In that list, I saw it mentions JUnit support for two schemas: Ant junit and Maven Surefire.

I checked both and Maven Surefire is the closest to the XML JUnitReport produces... however, it does not validate against the XSD (many elements are missing required attributes).

Is there a tool that loads the XML report that could serve as a validator of sorts? :-?

bioball commented 1 month ago

I've tried many times to look for a schema, but as far as I can tell, there's no real schema for JUnit reports. And, the many tools that create JUnit reports all differ in minor ways.

Tools like Jenkins that accept JUnit-style reports tend to just make a best-effort attempt to parse them, so, we just do the best we can to be conformant to what's out there.

jjmaestro commented 1 month ago

Arrrg CI failed because of linting! I could have sworn I did a final gw spotlessApply before commiting :( Anyway, I've just re-committed it, hopefully it'll all be fine now!

jjmaestro commented 1 month ago

OK, I've just pushed the resolved merge conflict... it passes all the same tests. @bioball is there any way to ensure the commit is not blocked in CI? I've seen it blocked ("on hold") for ~a week before :-/ Is there any reason why that happens? :-?

Thanks!!

jjmaestro commented 1 month ago

Tests failed for gradle-check-jdk17-windows!? 😮 Any help to repro these would be very welcomed, I've read the CI output and I'm not too sure what's failing / what's going on... especially since the tests seem to be the same tests that pass other CI runs and pass on my laptop! :-?

EDIT: ah, I think the error is the following but I'm not too sure: java.nio.file.NoSuchFileException: C:\Users\circleci\AppData\Local\Temp\junit15390432245720982242\build\test.xml

I usually double-check the reports like pkl-gradle/build/reports/tests/test/index.html but I don't know if it's possible to access those via the CircleCI interface.