I’ve written a block of code that’s supposed to unzip compressed .cmd files and run them.
I’d like to unit test it. So far for the test I’ve created a very simple cmd file (“echo hello world”) saved it and zipped it and processed it with my code. I can verify it works because if I replace “echo hello world” with “pause” a command window appears with the pause command. But that’s obviously not automated.
Is there any way I can automate this test so that it asserts something? Running a different DOS command for example?
Cheers,
Matt
Change the batch file to
echo Whatever > %temp%\MyResult.txt, then check that the file exists and has the correct contents.(And delete the file both before and after)