diff --git a/sqltoolsservice.sln b/sqltoolsservice.sln index 15ece77f..26e27176 100644 --- a/sqltoolsservice.sln +++ b/sqltoolsservice.sln @@ -19,6 +19,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.SqlTools.ServiceL EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.SqlTools.ServiceLayer.Test", "test\Microsoft.SqlTools.ServiceLayer.Test\Microsoft.SqlTools.ServiceLayer.Test.xproj", "{2D771D16-9D85-4053-9F79-E2034737DEEF}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.SqlTools.ServiceLayer.TestDriver", "test\Microsoft.SqlTools.ServiceLayer.TestDriver\Microsoft.SqlTools.ServiceLayer.TestDriver.xproj", "{CC785604-6277-4878-8DA9-360C47158E96}" +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{B7D21727-2926-452B-9610-3ADB0BB6D789}" ProjectSection(SolutionItems) = preProject scripts\archiving.cake = scripts\archiving.cake @@ -38,6 +40,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{F9978D78 build.sh = build.sh EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CodeCoverage", "CodeCoverage", "{87D9C7D9-18F4-4AB9-B20D-66C02B6075E2}" + ProjectSection(SolutionItems) = preProject + test\CodeCoverage\codecoverage.bat = test\CodeCoverage\codecoverage.bat + test\CodeCoverage\gulpfile.js = test\CodeCoverage\gulpfile.js + test\CodeCoverage\nuget.config = test\CodeCoverage\nuget.config + test\CodeCoverage\package.json = test\CodeCoverage\package.json + test\CodeCoverage\packages.config = test\CodeCoverage\packages.config + test\CodeCoverage\ReplaceText.vbs = test\CodeCoverage\ReplaceText.vbs + test\CodeCoverage\runintegration.bat = test\CodeCoverage\runintegration.bat + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -52,6 +65,10 @@ Global {2D771D16-9D85-4053-9F79-E2034737DEEF}.Debug|Any CPU.Build.0 = Debug|Any CPU {2D771D16-9D85-4053-9F79-E2034737DEEF}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D771D16-9D85-4053-9F79-E2034737DEEF}.Release|Any CPU.Build.0 = Release|Any CPU + {CC785604-6277-4878-8DA9-360C47158E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC785604-6277-4878-8DA9-360C47158E96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC785604-6277-4878-8DA9-360C47158E96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC785604-6277-4878-8DA9-360C47158E96}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -59,6 +76,8 @@ Global GlobalSection(NestedProjects) = preSolution {0D61DC2B-DA66-441D-B9D0-F76C98F780F9} = {2BBD7364-054F-4693-97CD-1C395E3E84A9} {2D771D16-9D85-4053-9F79-E2034737DEEF} = {AB9CA2B8-6F70-431C-8A1D-67479D8A7BE4} + {CC785604-6277-4878-8DA9-360C47158E96} = {AB9CA2B8-6F70-431C-8A1D-67479D8A7BE4} {B7D21727-2926-452B-9610-3ADB0BB6D789} = {F9978D78-78FE-4E92-A7D6-D436B7683EF6} + {87D9C7D9-18F4-4AB9-B20D-66C02B6075E2} = {AB9CA2B8-6F70-431C-8A1D-67479D8A7BE4} EndGlobalSection EndGlobal diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs index ce4002f3..d269bf97 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Driver/ServiceTestDriver.cs @@ -28,15 +28,9 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Driver public const string CodeCoverageToolEnvironmentVariable = "CODECOVERAGETOOL"; - public const string CodeCoverageOutputEnvironmentVariable = "CODECOVERAGEOUTPUT"; + public const string CodeCoverageOutputEnvironmentVariable = "CODECOVERAGEOUTPUT"; - /// - /// Environment variable that stores the path to the service host executable. - /// - public static string ServiceHostEnvironmentVariable - { - get { return "SQLTOOLSSERVICE_EXE"; } - } + public const string ServiceHostEnvironmentVariable = "SQLTOOLSSERVICE_EXE"; public bool IsCoverageRun { get; set; } @@ -44,6 +38,19 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Driver { string serviceHostExecutable = Environment.GetEnvironmentVariable(ServiceHostEnvironmentVariable); string serviceHostArguments = "--enable-logging"; + if (string.IsNullOrWhiteSpace(serviceHostExecutable)) + { + // Include a fallback value to for running tests within visual studio + serviceHostExecutable = + @"..\..\src\Microsoft.SqlTools.ServiceLayer\bin\Debug\netcoreapp1.0\win7-x64\Microsoft.SqlTools.ServiceLayer.exe"; + } + + // Make sure it exists before continuing + if (!File.Exists(serviceHostExecutable)) + { + throw new FileNotFoundException($"Failed to find Microsoft.SqlTools.ServiceLayer.exe at provided location '{serviceHostExecutable}'. " + + "Please set SQLTOOLSERVICE_EXE environment variable to location of exe"); + } //setup the service host for code coverage if the envvar is enabled if (Environment.GetEnvironmentVariable(ServiceCodeCoverageEnvironmentVariable) == "True") diff --git a/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Microsoft.SqlTools.ServiceLayer.TestDriver.xproj b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Microsoft.SqlTools.ServiceLayer.TestDriver.xproj new file mode 100644 index 00000000..1319ccb7 --- /dev/null +++ b/test/Microsoft.SqlTools.ServiceLayer.TestDriver/Microsoft.SqlTools.ServiceLayer.TestDriver.xproj @@ -0,0 +1,19 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + CC785604-6277-4878-8DA9-360C47158E96 + Microsoft.SqlTools.ServiceLayer.TestDriver + .\obj + .\bin\ + v4.5.2 + + + 2.0 + + +