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

RequireParallelTesting Annotation not working #1261

Closed
3 tasks done
thamp59 opened this issue Jun 5, 2024 · 1 comment · Fixed by #1265
Closed
3 tasks done

RequireParallelTesting Annotation not working #1261

thamp59 opened this issue Jun 5, 2024 · 1 comment · Fixed by #1265

Comments

@thamp59
Copy link
Contributor

thamp59 commented Jun 5, 2024

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

When using @RequireParallelTesting annotation in test classes for test task I would expect test results to be the same as test classes not running in parallel.

Current Behavior

For tests using the @RequireParallelTesting annotation, the error received is io.mockk.MockKException: no answer found for <some mock> among the configured answers

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Use @RequireParallelTesting with Test Classes
  2. Debug through to clearAllMocks() and observe that it is still being hit

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

My team was waiting on #1133 to be completed as that seemed to be the issue related to our desire to run our tests in parallel. Upon checking that #1133 was completed and deployed, we updated our version to latest and noticed the annotation still was not working.

  • MockK version: 1.13.11
  • OS: Windows 11
  • Kotlin version: 1.9.24
  • JDK version: 21
  • JUnit version: 4.13.2
  • Type of test: Unit Test

Possible Solution

The annotation is not being used
image

If the annotation takes priority over the system property (this looks to be consistent with other flags in the repo) the ExtensionContext.requireParallelTesting should become:

  private val ExtensionContext.requireParallelTesting: Boolean
    get() = testClass.requireParallelTesting ||
      getConfigurationParameter(REQUIRE_PARALLEL_TESTING).map { it.toBoolean() }.orElse(false)
@wallind
Copy link
Contributor

wallind commented Jun 20, 2024

@Raibaz do you think we could consider the PR #1265?

I'm pretty confident the annotation is non-functional atm, and that PR will fix it.

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 a pull request may close this issue.

2 participants