Skip to content

test: migrate to xUnit - #38

Merged
justinmk merged 1 commit into
neovim:masterfrom
alsi-lawr:feat/rework-test-boundaries
Jul 18, 2026
Merged

test: migrate to xUnit#38
justinmk merged 1 commit into
neovim:masterfrom
alsi-lawr:feat/rework-test-boundaries

Conversation

@alsi-lawr

@alsi-lawr alsi-lawr commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Migrates the existing test suite from MSTest/VSTest to xUnit v3, and Microsoft Testing Platform.

Separates unit and Neovim process/RPC integration tests into distinct projects and CI steps without adding new test coverage.

Blocked by

Closes #29

@alsi-lawr
alsi-lawr marked this pull request as ready for review July 18, 2026 14:19
@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from dbc8a1f to b0be063 Compare July 18, 2026 14:22
@alsi-lawr
alsi-lawr marked this pull request as draft July 18, 2026 14:26
@alsi-lawr

Copy link
Copy Markdown
Contributor Author

Switched back to draft to do a little cleanup from the remote plugin removal PR

@justinmk

Copy link
Copy Markdown
Member

why is Shouldly needed? avoid deps if possible

@alsi-lawr

alsi-lawr commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

why is Shouldly needed? avoid deps if possible

It's not needed, but it's a very nice FOSS assertion framework that makes the tests easier to read. Can remove if desired, but it's pretty standard/normal for dotnet libraries to use shouldly/fluentassertions, granted it does defeat the project's stated goal of having a minimal maintenance burden

@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from b0be063 to 05f6aeb Compare July 18, 2026 14:48
@justinmk

justinmk commented Jul 18, 2026

Copy link
Copy Markdown
Member

that makes the tests easier to read.

as i mentioned, this (and any api client) should be simple enough for that not to matter.

also the BDD test description format is just stupid (i wish we didn't have it in neovim core). although it looks like Shouldly is trying to be like "jest", which is also just sugar without a real purpose, and doesn't justify an extra dep

@alsi-lawr

Copy link
Copy Markdown
Contributor Author

that makes the tests easier to read.

as i mentioned, this (and any api client) should be simple enough for that not to matter.

also the BDD test description format is just stupid (i wish we didn't have it in neovim core). although it looks like Shouldly is trying to be like "jest", which is also just sugar without a real purpose, and doesn't justify an extra dep

I'm removing shouldly now, but what's the alternative test description format you want to adopt? I don't personally think the existing TestMessageDeserialization is better, every test starts with Test*, which is redundant since it's in a test project. If it were f# I'd just write actual english scenario names like

let ``A request to embedded Neovim deserializes its response`` () =
...

@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from 05f6aeb to 8e5a3e1 Compare July 18, 2026 15:01
@alsi-lawr alsi-lawr changed the title test: migrate to xUnit and Shouldly test: migrate to xUnit Jul 18, 2026
@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from 8e5a3e1 to abc2ede Compare July 18, 2026 15:03
@alsi-lawr
alsi-lawr marked this pull request as ready for review July 18, 2026 16:14
@justinmk

Copy link
Copy Markdown
Member

I don't personally think the existing TestMessageDeserialization is better, every test starts with Test*, which is redundant since it's in a test project.

that's completely fine, and again, this repo isn't going to have zillions of tests so it doesn't matter.

If it were f# I'd just write actual english scenario names like

that's BDD format. it is awkward to reference in discussions, code comments, etc, because it's just a free-form name, the test doesn't have an "identifier".

it also seems to encourage no restraint whatsoever when people decide test names.

Comment thread .github/workflows/test.yml Outdated
-p:ContinuousIntegrationBuild=true

- name: Test
- name: Unit tests

@justinmk justinmk Jul 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remind me why we need separate unit vs integ tests? all tests should run actualy Nvim instances, it's extremely fast. so there is no need for "fast" (unit) vs "slow" (integ).

every single test in Neovim core, out of 9000+ tests, runs a new instance of nvim

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The unit/integration distinction is not intended to be fast versus slow. It is a logical separation: the NvimTypesMap tests are deterministic in-process tests, while the process/RPC tests require an external Neovim executable.

If the objection is that all tests should actually run Nvim, then the old tests didn't do this. Do you propose we just remove the unit tests entirely?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The unit/integration distinction is not intended to be fast versus slow. It is a logical separation: the NvimTypesMap tests are deterministic in-process tests, while the process/RPC tests require an external Neovim executable.

the only useful distinction is fast vs slow. nothing else matters

@alsi-lawr

Copy link
Copy Markdown
Contributor Author

I don't personally think the existing TestMessageDeserialization is better, every test starts with Test*, which is redundant since it's in a test project.

that's completely fine, and again, this repo isn't going to have zillions of tests so it doesn't matter.

If it were f# I'd just write actual english scenario names like

that's BDD format. it is awkward to reference in discussions, code comments, etc, because it's just a free-form name, the test doesn't have an "identifier".

it also seems to encourage no restraint whatsoever when people decide test names.

I agree Given_When_Then is overkill here, but TestMessageDeserialization is too vague. It names the mechanism rather than the concrete expectation, and the Test prefix is redundant. Something like EmbeddedNvimRequestReturnsExpectedResponse is still a normal identifier, just a more useful one.

I also wasn't suggesting we use the standard should-style f# test naming, I was just saying that's a standard in f# when you can have backticked plain-English identifiers.

I don't mind the name being free-form if it makes the failure immediately clear.

TestMessageDeserialization identifies the general area, but not the exact expectation. A plain-English name can still be searched for and referenced, while giving more useful context when it fails.

Names can still be kept concise through review.

@justinmk

justinmk commented Jul 18, 2026

Copy link
Copy Markdown
Member

Something like EmbeddedNvimRequestReturnsExpectedResponse is still a normal identifier, just a more useful one.

sure, i just assumed the "Test" prefix was some sort of expectation of xUnit or whatever. if it's not, then no problem.

btw, is xUnit the .NET default/builtin test framework, i.e. not a 3P dependency?

I don't mind the name being free-form if it makes the failure immediately clear.

in practice that almost never matters. what ends up happening is people vomit out paragraphs of descriptions, to solve a problem that never really existed. when a test fails, the assert is what usually matters.

and meanwhile, the long test names cause permanent, ongoing suffering from noisy, over-verbose CI logs. so that's a permanent, ongoing cost to solve the uncommon case.

so everyone does these push-ups to solve the uncommon case, when it could all just be avoided.

most of the industry just got this wrong.

Names can still be kept concise through review.

yep, but not worth adding a dependency.

@alsi-lawr

Copy link
Copy Markdown
Contributor Author

Something like EmbeddedNvimRequestReturnsExpectedResponse is still a normal identifier, just a more useful one.

sure, i just assumed the "Test" prefix was some sort of expectation of xUnit or whatever. if it's not, then no problem.

btw, is xUnit the .NET default/builtin test framework, i.e. not a 3P dependency?

xUnit/NUnit/TUnit/MSTest.SDK are all viable. XUnit/NUnit/MSTest.SDK all get support from microsoft, with MSTest.SDK only recently having a modernisation from microsoft to unbind it from its legacy vs days, but I think that's their official internally released one as of 2024. xUnit is a mature independent test platform that Microsoft officially support and contribute to regularly, and it's under the .NET Foundation, so it's not "3rd party" as much as it is independent. xUnit is just a more terse default that people stick to, NUnit is based off of JUnit, and TUnit is a recent super fast parallelised test library.

@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from abc2ede to bba9ff8 Compare July 18, 2026 17:57
@justinmk

Copy link
Copy Markdown
Member

yeah, MS changes the landscape a lot, so even if we try to stick with the "default", that rug could be pulled at any time. so xUnit is fine

the only remaining sticking point is:

Do you propose we just remove the unit tests entirely?

I suggest just leaving it as "Test". don't try to carefully separate "unit" vs "integ". it's a waste of time.

there is no scenario where the tests in this repo should ever be "non-deterministic", nor should they take more than 30s (maybe 60s) in total. and if that happens we should ask why, and fix it, rather than saying "oh it's integ, no big deal".

@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from bba9ff8 to a1357dd Compare July 18, 2026 18:26
Comment thread test/NvimClient.Test/NvimTests.cs
Comment thread .github/workflows/test.yml Outdated
@alsi-lawr
alsi-lawr force-pushed the feat/rework-test-boundaries branch from a1357dd to bae6af2 Compare July 18, 2026 18:44
@justinmk
justinmk merged commit ec721c1 into neovim:master Jul 18, 2026
2 checks passed
@alsi-lawr
alsi-lawr deleted the feat/rework-test-boundaries branch July 24, 2026 10:14
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.

proposal: Rework test boundaries and migrate tests to xUnit/Shouldly

2 participants