rubberduck-vba / Rubberduck3

COM add-in for the VBIDE
GNU General Public License v3.0
89 stars 17 forks source link

Change testing framework to xUnit #67

Closed BZngr closed 1 year ago

BZngr commented 1 year ago

Also installs Moq mocking framework

Replaces PR #66 based on recent discussion in Discord

Greedquest commented 1 year ago

Out of interest, how do you invoke these tests from the command line, so I can review the github action pr I was making

BZngr commented 1 year ago

@Greedquest I found this which may be useful.

Greedquest commented 1 year ago

Thanks @BZngr that looks very detailed. I also wanted to check if there was a particular set of flags you use to run the tests in this PR. I guess you just run them in visual studio and it "works"?

Looks like you have set up everything you need to run the tests with dotnet test, although I don't know if I have to supply the .sln file or the Tests/Rubberduck.Tests/Rubberduck.Tests.csproj file. Does the sln file contain the metadata to identify projects that have tests?

BZngr commented 1 year ago

Does the sln file contain the metadata to identify projects that have tests?

Nothing in the sln file that I can see. The metadata you are looking for is in the *.csproj files. Starting from the sln file, there are paths to all the .csproj files in the solution. So, there is a way to "get there" from the sln file.

In this PR, see file Tests/Rubberduck.Tests/Rubberduck.Tests.csproj lines 21 and 22. The line 21 identifies the test framework. And, the test 'runner' (line 22) enables it to just "work" with the visual studio test explorer.

FWIW, I accidently discovered that multiple test frameworks (and runner adapters) could be concurrently present (and work) within the test project's csproj file . The test code files/classes identify which testing framework to use.