-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildTestSuite.bat
31 lines (23 loc) · 1.21 KB
/
buildTestSuite.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
:: In case this bat file doesn't execute properly on your machine, follow the steps below
::
:: Copy the code from lines to 10 through 33
:: Paste and execute this code in an Elevated (Run as Administrator) Developer Command Prompt for VS 2022
:: This line adds the VS Developer Command Prompt bat script to run the msbuild.exe & vstest.console.exe commands
call "D:\Program Files\Microsoft Visual Studio\VC\Auxiliary\Build\vcvarsall.bat" x86
:: Switch directory to the project
@echo off
set /p email=Enter Email to Send Results To:
:: Build the project solution and log the results
msbuild.exe %cd%\Pacman.sln -fileLogger
SET buildResults=%cd%\msbuild.log
:: Run all project tests and log the results
vstest.console.exe %cd%\UnitTestProject1\bin\Debug\UnitTestProject1.dll /TestAdapterPath:%cd%\packages\MSTest.TestAdapter.2.2.10\build\_common /logger:trx
cd TestResults
for /f %i in ('dir /b/a-d/od/t:c') do set latestTest=%i
echo Most recent subfolder: %latestTest%
:: Add your SMTP email & password credentials
SET username=""
SET password=""
SET testResults=%cd%\%latestTest%
cd ..
powershell -ExecutionPolicy Bypass -Command "& '.\sendEmailScript.ps1' '%username%' '%password%' '%testResults%' '%buildResults%' '%email%'"