Skip to content

Commit

Permalink
Changed vstest log file path to absolute in TranslationLayer.E2ETest … (
Browse files Browse the repository at this point in the history
#873)

* Changed vstest log file path to absolute in TranslationLayer.E2ETest sample program.
Added default run parameters to TranslationLayer.E2ETest sample program.
Modified TranslationLayer.ConsoleParameters.LogFilePath to properly handle relative paths, or absolute paths.

* Handled null path return from Path.GetDirectoryName in TranslationLayer.LogFilePath set.

* Removed extraneous debug message.
  • Loading branch information
JakenVeina authored and codito committed Jun 20, 2017
1 parent 73f4a07 commit cdcdf90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Program
{
public static int Main(string[] args)
{
if(args == null || args.Length < 1)
if (args == null || args.Length < 1)
{
Console.WriteLine(@"Please provide appropriate arguments. Arguments can be passed as following:");
Console.WriteLine(@"Microsoft.TestPlatform.TranslationLayer.E2ETest.exe --runner:'[vstest.console path]' --testassembly:'[assemblyPath]' --testadapterpath:'[path]'");
Expand Down Expand Up @@ -57,7 +57,8 @@ public static int Main(string[] args)
Console.WriteLine("Test Adapter Path: " + testadapterPath);
Console.WriteLine("-------------------------------------------------------");

IVsTestConsoleWrapper consoleWrapper = new VsTestConsoleWrapper(runnerLocation, new ConsoleParameters { LogFilePath = @"log.txt" });
var logFilePath = Path.Combine(Directory.GetCurrentDirectory(), @"log.txt");
IVsTestConsoleWrapper consoleWrapper = new VsTestConsoleWrapper(runnerLocation, new ConsoleParameters { LogFilePath = logFilePath });

consoleWrapper.StartSession();
consoleWrapper.InitializeExtensions(new List<string>() { testadapterPath });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"Microsoft.TestPlatform.TranslationLayer.E2ETest": {
"commandName": "Project",
"commandLineArgs": "--runner:\"bin\\Debug\\net46\\win7-x64\\vstest.console.exe\" --testadapterpath:\"bin\\Debug\\net46\\win7-x64\\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll\" --testassembly:\"bin\\Debug\\net46\\win7-x64\\UnitTestProject.dll\""
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public string LogFilePath
set
{
ValidateArg.NotNullOrEmpty(value, "LogFilePath");
if (!fileHelper.DirectoryExists(Path.GetDirectoryName(value)))
var directoryPath = Path.GetDirectoryName(value);
if (!string.IsNullOrEmpty(directoryPath) && !fileHelper.DirectoryExists(Path.GetDirectoryName(value)))
{
throw new ArgumentException("LogFilePath must point to a valid directory for logging!");
}
Expand Down

0 comments on commit cdcdf90

Please sign in to comment.