MSTest dotnet Test failing from the command prompt

I have a TestMethod that clones a git repo and then performs some operations on the folder. When I run this test from VS test explorer, I do not have issues, However, when i run the same test from the command line using dotnet Test I get an error. I am assuming its because the enivornment im running that from does not have Git installed so it failed. After researching online, the only solution I got was to add the git.exe file to my test project and a make sure to set the Copy to Output Directory to Copy if newer or Copy always and then use the that file path in my ProcessStartInfo method but that didnt work either. Got the error error launching git: The system cannot find the path specified. What else can I do?
2 Replies
Neophyte
Neophyte8mo ago
If you are running the test method locally from console, does it work? Are you sure your git.exe is at the same location as your application path? Based on the error message it seems that despite copying to the output directory, your application cannot find it. (you either try to register git.exe path to the environment during runtime or fix the path).
willCodeforFood
willCodeforFoodOP8mo ago
Hi, the test method works locally. All test passes when run the test from the test explorer I'll try the suggestions you gave
Want results from more Discord servers?
Add your server