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

Refactor DiktatMavenPluginIntegrationTest to ease troubleshooting in case of test failures #1304

Merged

Conversation

unix-junkie
Copy link
Contributor

What's done:

  • TestInfo is now passed to test methods so that jacoco-it-*.exec files
    are unique.
  • jacoco-it-*.exec files are now deleted before each test, so repeated test
    invocations no longer cause failures.
  • Added String.assertContains() extensions so that assertion failures have
    meaningful messages.
  • Proofread and expanded the KDoc comment.

…n case of test failures

### What's done:

 * `TestInfo` is now passed to test methods so that `jacoco-it-*.exec` files
   are unique.
 * `jacoco-it-*.exec` files are now deleted before each test, so repeated test
   invocations no longer cause failures.
 * Added `String.assertContains()` extensions so that assertion failures have
   meaningful messages.
 * Proofread and expanded the KDoc comment.
@unix-junkie unix-junkie requested a review from petertrr May 26, 2022 09:42
@unix-junkie unix-junkie enabled auto-merge (squash) May 26, 2022 09:44
*
* @param other the expected substring.
*/
private inline fun String.assertContains(other: CharSequence,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that assertContains is there in kotlin.test. Why do we need these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. But we don't have it added to our pom.xml yet. Should I add kotlin-test instead?

* * maven execution results are analyzed here; `.mvn/jvm.config` is used to attach jacoco java agent to every maven process and generate individual execution reports.
*
* When within an IDE (e.g.: _IDEA_), don't run this test directly: it's
* expected to be executed from a forked JVM. Instead, run a `verify` _lifecycle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you have a chance to try to run this forked JVM with remote debugging support? Such instructions would be useful here too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, some notes about the remote debugger in the case of diktat will be great here.

But actually I love ultimate debugging tool called print

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on my TODO list, will update the KDoc.

@orchestr7
Copy link
Member

FYI: you can run mvn diktat:fix to fix all issues automatically

…en/DiktatMavenPluginIntegrationTest.kt

Co-authored-by: Peter Trifanov <peter.trifanov@mail.ru>
@codecov
Copy link

codecov bot commented May 26, 2022

Codecov Report

Merging #1304 (daed53d) into master (ff6e784) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #1304   +/-   ##
=========================================
  Coverage     82.01%   82.01%           
  Complexity     2530     2530           
=========================================
  Files           105      105           
  Lines          7201     7201           
  Branches       2058     2058           
=========================================
  Hits           5906     5906           
  Misses          346      346           
  Partials        949      949           
Flag Coverage Δ
unittests 82.01% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 ff6e784...daed53d. Read the comment docs.

### What's done:

 * Indentation fixed with diktat:fix@diktat
@unix-junkie unix-junkie disabled auto-merge May 26, 2022 10:44
### What's done:

 * Switched to AssertJ and dropped the extensions
@unix-junkie unix-junkie merged commit 23ebf80 into master May 26, 2022
@unix-junkie unix-junkie deleted the bugfix/andrey.shcheglov/maven-plugin-integration-test branch May 26, 2022 11:33
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.

3 participants