apache / apache/lucenenet

Make assertions into a 1st class feature in the test framework

Open
#306 4 comments 0 reactions 1 assignee Claimed by @paulirwin View on GitHub
design is:enhancement pri:normal test-framework
Dominant language
C#
Stars
2.4k
Forks
658
Avg merge
3d 5h
Merged PRs (30d)
9

Description

We recently discovered that the assertions provided by NUnit do not provide any support for primitive types and in those cases will default to `object` which causes boxing/unboxing when doing assertions. This can be a huge drain on performance when this operation is done in a tight loop.

It is clear that end users will likely run into similar issues with testing that we did. While we have addressed the problem, we did so in 2 assertions types that are both internal. We need to create a public API for assertions that end users of the test framework can use.

- Missing overloads need to be added to support all of the operations that NUnit does
- Custom asserts that we created need to be expanded to include all primitive types
- A logical way to make these asserts "native" in `LuceneTestCase` and all of its subclasses needs to be devised

In Lucene, `LuceneTestCase` simply subclassed `Assert`. However, due to a difference in naming conventions between NUnit and JUnit, this would seem odd. For example, instead of `AssertEquals`, the NUnit team named their method `AreEqual`. While this isn't such a problem, it would be inconsistent with all of the other custom assertions in the test framework (i.e. `AssertAnalyzesTo`).

In addition, API documentation should be provided for each of the assertions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.