❔ Creating a github workflow to test solution (MSTest)
I have this solution
https://github.com/caedenph/wa-tor
I have two projects within it, the base one is the implementation of this algorithm, and the other project is within
WaTorTests/
.
How can I link the tests in WaTorTests/
to the root project so that I can run dotnet test
?
For context:
23 Replies
@V.EINA Jaken Apologies for not responding earlier, started by just rewriting the code in c#. You mentioned the c# file naming conventions (for the .csproj and .sln) should be valid identifiers? What do you mean?
What works better for those files,
Wa-Tor
or WaTor
?you can cd into the folder with github actions, or add WaTorTests to your dotnet command
How do I add waTorTests to my dotnet command?
you already typed it
So far I haven't been able to test from cmd at all
ah wait it doesn't see any test projects
dotnet test WaTorTests should run the 14 tests
it ran nothing afaik
Are the test projects in your SLN?
no?
hmmm might be some .NET framework 4.7 trickery
I've only done this with modern .NET versions
damn
is there a reason you're on a very old .NET version?
yeah, the exam board/schools use theis version
dont you love outdated system archichtecture
ah I feel sorry for you :/
theres got to be a way to test from cmd tho
one of those is a valid name you could give to something in C# code, and one is not
Got it
Can I just rename the Wa-Tor or will this break something
what's named that, currently?
the
.sln
renaming the file won't affect anything
that won't change the solution's "name" per se
but it also isn't hurting anything
Okay
I showed the
dotnet test
above, do you know how I can link the projects?The
dotnet
cli isn't compatible with .NET Framework¹ iirc
Though you could try running mstest
like what a person said in on this StackOverflow post
I tried to run your repo's tests using
& 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\MSTest.exe' /testcontainer:"WaTorTests.dll"
but originally failed
After checking a bit, removing the nuget package MSTest.TestFramework
and replacing it with MicrosoftVisualStudioQualityToolsUnitTestFramework
seemed to fix it (Though doing so makes testing via an IDE break)
! Please note, that the nuget package above is not actually from microsoft but rather an author called "juniho", adding unverified nuget packages can lead to malware being executed. that being said, the nuget package has 500k downloads and has been up since 2020, its likely not that.
Anyways, this is the CLI Output after changing to the new nuget package:
The following StackOverflow post shows how you can run mstest.exe
through github actions for your workflow.
Alternate options i've found is downloading visual studio build tools and using their vstest
which too has their own respective github actions workflowWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.