NightOwl888 opened a new pull request, #1125:
URL: https://github.com/apache/lucenenet/pull/1125

   <!-- Thank you for submitting a pull request to our repo. -->
   
   <!-- Please do NOT submit PRs for features in newer versions of Lucene. We 
should keep the target version consistent across our repository to make the 
upgrade process to newer versions of Lucene go smoothly. -->
   
   <!-- If this is your first PR in the Lucene.NET repo, please run through the 
checklist
   below to ensure a smooth review and merge process for your PR. -->
   
   - [x] You've read the [Contributor 
Guide](https://github.com/apache/lucenenet/blob/main/CONTRIBUTING.md) and [Code 
of Conduct](https://www.apache.org/foundation/policies/conduct.html).
   - [x] You've included unit or integration tests for your change, where 
applicable.
   - [x] You've included inline docs for your change, where applicable.
   - [x] There's an open issue for the PR that you are making. If you'd like to 
propose a change, please [open an 
issue](https://github.com/apache/lucenenet/issues/new/choose) to discuss the 
change or find an existing issue.
   
   <!-- Once all that is done, you're ready to go. Open the PR with the content 
below. -->
   
   Summary of the changes (Less than 80 chars)
   
   Fixes #1106
   
   ## Description
   
   This creates a new `RepeatAttribute` that is nested within `LuceneTestCase`. 
In addition to repeating the test X number of times, this attribute ensures 
that each iteration resets the test seed on `RandomizedContext.RandomGenerator` 
so failed test conditions can be replicated without the need to apply the 
`RepeatAttribute`.
   
   This sets a precedent for how to test other NUnit extensions (such as 
attributes) so we can also add tests to confirm they behave as expected. Some 
bits of the NUnit test approach were added so we can integration test the 
`RepeatAttribute` to confirm the correct behavior. The commit 
cdfd62bbc8e4f89382fd2624f6889d0750163357 includes additional asserts that 
verify:
   
   - The same random seed is used for the duration of the test
   - The same test seed is used for the duration of the test
   - The test seed changes from one iteration to the next
   
   Note that `RepeatAttribute` does not repeat the `OneTimeSetUp()` or 
`OneTimeTearDown()` during each iteration, so every repeated try will use the 
same culture, time zone, similarity, and codec. Perhaps we can do that at some 
future point, but it is more complicated to maintain the 
`TestExectutionContext`, `RandomizedContext` and seeds to make that happen.
   
   The format of the random seed string has also changed to use 2 hexadecimal 
numbers separated by a `:`. However, existing seeds with one hexidecimal number 
can still be parsed to replicate test failures. This not only allows us to make 
features that update the seed, but also will make test replicability more 
stable across source code updates on tests.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to