-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
ConsoleLauncher should output diff of expected and actual String values #3139
Comments
Potential library to implement this: https://github.com/java-diff-utils/java-diff-utils @carolosf We've briefly discussed this in our team call today and think this would be feasible since We'll have to take a closer look first to decide whether |
If it becomes the default behaviour it might break IDEs and plug-ins - which is why I suggested a totally separate flag. I didn't spend much time on it but I noticed previously that the Bazel plugin for IntelliJ does a regex for "expected but was" and splits the results. Thanks for discussing though - if implemented it would significantly reduce my debugging time! |
@carolosf IDEs and build tools usually do not run tests via |
Team decision: Change |
@carolosf Would you be interested to work on a PR for this? |
Hey @marcphilipp & @carolosf - if ok for you, I'd like to provide a PR for this. Any veto? |
Would love to but I don't have any capacity to work on this in the near future right now. |
I'm not working on this. @marcphilipp Anything to add? |
@bechte Sure, go ahead |
To introduce a new dependency to a library, I assume that I am extending the list in
And with that plus running a build, I am able to add the following to the platform console project:
Questions to the team, FYI: @marcphilipp, @sbrannen
|
With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced. java-diff-utils is used to create a diff from the expected and the actual result and report it. See #3139
With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced. java-diff-utils is used to create a diff from the expected and the actual result and report it. See #3139
With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced. java-diff-utils is used to create a diff from the expected and the actual result and report it. See #3139
With this commit, a dependency to https://github.com/java-diff-utils/java-diff-utils is introduced. java-diff-utils is used to create a diff from the expected and the actual result and report it. See #3139
I have added some questions within the PR #3397. |
Tasks completed: 1. Locate ConsoleLauncher output 2. Check if actual and expected of AssertionFailedError are both type of CharSequence To do list: 1. Add diff function dependency 2. Using diff to generate the output desired
Hi, I am currently a college student that wants to contribute to Junit 5 project. I tested the code by building a console standalone jar to run one test case I wrote. ps: Can someone look at my code to see if I did anything wrong? it only change a tiny part of original code. |
Tasks completed: 1. Locate ConsoleLauncher output 2. Check if actual and expected of AssertionFailedError are both type of CharSequence To do list: 1. Add diff function dependency 2. Using diff to generate the output desired Issue: junit-team#3139
Tasks completed: 1. Locate ConsoleLauncher output 2. Check if actual and expected of AssertionFailedError are both type of CharSequence 3. Add diff function dependency 4. Using diff to generate the output desired Issue: junit-team#3139
delete one line of extra code
About the auto test case, I can not think a good way to test it, Could you please give me some idea how to implement the execution below? |
Fixed different profile issue. Tasks completed: 1. Locate ConsoleLauncher output 2. Check if actual and expected of AssertionFailedError are both type of CharSequence 3. Add diff function dependency 4. Using diff to generate the output desired ToDo: 1.Automatic test case for diff output Issue: junit-team#3139
Add external diff module to module documentation For unknown reason, the test cases can not find the external module while the gradle can build normally. Issue: junit-team#3139
Conclusion of the problems that I had encountered:
|
@XJ114514 Could you please open a draft PR so it's easier for us to take a look? |
Thank you for getting back to me. I made the draft PR after testing the generated standalone jar. |
1. Add diffPrinter class 2. replace diff in consoleTestExecutor with diffPrinter - will be deleted evetually 3. mark the location of adding diff in flatPrinter and verboseTreePrinter. Issue: junit-team#3139
1. Add a `testPlan` getter to `platform/launcher/listeners/SummaryGeneratingListener.java`. 2. DiffPrinter now needs testPlan to display the testMethod info. Issue: junit-team#3139
As a developer if I am running JUnit tests using the Console Launcher on the command line if two large strings are found to be different and I get "expected:" "but was:" if I want to see what was different I need to copy the strings and manually diff them.
It would be easier if there was --details flag or another flag (I think another flag is a better option) that would show me a diff between the two strings for actionable results. In most cases using an IDE is suitable but in workflows such as Bazel and CI it would be useful if a diff would be displayed.
Apologies if this is already supported didn't find anything obvious in the docs.
The text was updated successfully, but these errors were encountered: