You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "NightOwl888 (via GitHub)" <gi...@apache.org> on 2025/01/20 07:50:23 UTC

[I] Create [Repeat] attribute that is RandomizedContext aware [lucenenet]

NightOwl888 opened a new issue, #1106:
URL: https://github.com/apache/lucenenet/issues/1106

   ### Is there an existing issue for this?
   
   - [x] I have searched the existing issues
   
   ### Task description
   
   The NUnit `[Repeat]` attribute is unaware of our `RandomizedContext` class. As a result, each iteration reuses the `RandomizedContext.RandomGenerator` instance without first resetting the seed. While this technically still makes the initial seed repeatable, it requires the `[Repeat]` attribute to repeat the result and it also requires the same number of iterations that the first result took to fail. This isn't very helpful when debugging, since the NUnit `[Repeat]` attribute doesn't report which iteration caused a failure and it is cumbersome to wrap a test in a loop so it can be repeated x number of times before stepping through in the iteration that is known to fail.
   
   To fix this, we should create a custom `[Repeat]` attribute.
   
   Much like our existing attributes, it should be named `RepeatAttribute` and nested within `LuceneTestCase`. This ensures that when participating in the test framework, adding `[Repeat(100)]` to a test will use our custom `RepeatAttribute` by default even if the `NUnit.Framework` namespace is already imported and there won't be a conflict. If test assembly has a class with tests that doesn't subclass `LuceneTestCase`, NUnit's `[Repeat(100)]` attribute will be the default.
   
   The `[Repeat]` attribute should update the `RandomizedContext.TestSeed` on each iteration. `RandomizedContext.RandomSeedAsHex` should include both the `RandomizedContext.RandomSeed` and `RandomizedContext.TestSeed` separated by a colon. This ensures the correct test seed is used to repeat the exact random test run. When used without the `[Repeat]` attribute, this makes debugging much easier.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Create [Repeat] attribute that is RandomizedContext aware [lucenenet]

Posted by "NightOwl888 (via GitHub)" <gi...@apache.org>.
NightOwl888 closed issue #1106: Create [Repeat] attribute that is RandomizedContext aware
URL: https://github.com/apache/lucenenet/issues/1106


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org