Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Adding beginning of Unit Test Framework from PTVS. StevDo Share conta…
Browse files Browse the repository at this point in the history
…ins the nuget

package from github.com/microsoft/visualstudio-testhost that we are using. Soon it
will be on proper github but until then we will use the private share.
  • Loading branch information
crwilcox committed Jan 29, 2016
1 parent dd49905 commit 29111cc
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 1 deletion.
1 change: 1 addition & 0 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="VS External" value="\\cpvsbuild\drops\dd\NuGet" />
<add key="VS Android Emulator" value="\\cpvsbuild\Drops\Emulator\Nuget" />
<add key="StevDo Share" value="\\stevdopc\Share\" />
</packageSources>
</configuration>
24 changes: 24 additions & 0 deletions src/R.Settings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@
<VSThreadingAssembly>Microsoft.VisualStudio.Threading, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL</VSThreadingAssembly>
</PropertyGroup>

<!--
Inside Visual Studio, we want to deploy to the experimental hive when
building for ease of debugging.
-->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<DeployExtension Condition="'$(DeployExtension)' == ''">true</DeployExtension>
<DeployVSTemplates Condition="'$(DeployVSTemplates)' == ''">false</DeployVSTemplates>
<CreateVsixContainer Condition="'$(CreateVsixContainer)' == ''">false</CreateVsixContainer>
<CopyVsixManifestToOutput Condition="'$(CopyVsixManifestToOutput)' == ''">true</CopyVsixManifestToOutput>
<RegisterOutputPackage Condition="'$(RegisterOutputPackage)' == ''">true</RegisterOutputPackage>
</PropertyGroup>

<!--
Outside of Visual Studio, we want to create VSIX containers rather than
deploying to the experimental hive.
-->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<DeployExtension Condition="'$(DeployExtension)' == ''">false</DeployExtension>
<DeployVSTemplates Condition="'$(DeployVSTemplates)' == ''">false</DeployVSTemplates>
<CreateVsixContainer Condition="'$(CreateVsixContainer)' == ''">false</CreateVsixContainer>
<CopyVsixManifestToOutput Condition="'$(CopyVsixManifestToOutput)' == ''">true</CopyVsixManifestToOutput>
<RegisterOutputPackage Condition="'$(RegisterOutputPackage)' == ''">false</RegisterOutputPackage>
</PropertyGroup>

<!-- Signing -->
<PropertyGroup Condition=" '$(SignType)' == 'real' OR '$(SignType)' == 'test' ">
<DefineConstants>$(DefineConstants);SIGN</DefineConstants>
Expand Down
15 changes: 15 additions & 0 deletions src/R.sln
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
CodeCoverage.runsettings = CodeCoverage.runsettings
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.UI.Test", "UnitTests\UI\Microsoft.UI.Test\Microsoft.UI.Test.csproj", "{2BBB937B-EFD3-48AA-BEF8-05E203589D24}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -512,6 +514,18 @@ Global
{130C9240-9537-42D4-A62C-2A13815F0020}.Release|x64.Build.0 = Release|Any CPU
{130C9240-9537-42D4-A62C-2A13815F0020}.Release|x86.ActiveCfg = Release|Any CPU
{130C9240-9537-42D4-A62C-2A13815F0020}.Release|x86.Build.0 = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|x64.ActiveCfg = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|x64.Build.0 = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|x86.ActiveCfg = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Debug|x86.Build.0 = Debug|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|Any CPU.Build.0 = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|x64.ActiveCfg = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|x64.Build.0 = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|x86.ActiveCfg = Release|Any CPU
{2BBB937B-EFD3-48AA-BEF8-05E203589D24}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -536,5 +550,6 @@ Global
{E4528324-C399-48D2-AB38-66D951158F12} = {EE50720D-A0E5-45EE-B2EC-E065B569DB27}
{0D80F608-CF60-42F8-A5E1-4E0ACFA384AF} = {EE50720D-A0E5-45EE-B2EC-E065B569DB27}
{130C9240-9537-42D4-A62C-2A13815F0020} = {EE50720D-A0E5-45EE-B2EC-E065B569DB27}
{2BBB937B-EFD3-48AA-BEF8-05E203589D24} = {EE50720D-A0E5-45EE-B2EC-E065B569DB27}
EndGlobalSection
EndGlobal
114 changes: 114 additions & 0 deletions src/UnitTests/UI/Microsoft.UI.Test/Microsoft.UI.Test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2BBB937B-EFD3-48AA-BEF8-05E203589D24}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.UI.Test</RootNamespace>
<AssemblyName>Microsoft.UI.Test</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudioTools.MockVsTests.14.0, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
<HintPath>..\..\..\..\NugetPackages\Microsoft.VisualStudioTools.TestUtilities.14.0.0.0.0\lib\net45\Microsoft.VisualStudioTools.MockVsTests.14.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudioTools.TestUtilities.14.0, Version=1.0.0.2015, Culture=neutral, processorArchitecture=x86">
<HintPath>..\..\..\..\NugetPackages\Microsoft.VisualStudioTools.TestUtilities.14.0.0.0.0\lib\net45\Microsoft.VisualStudioTools.TestUtilities.14.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudioTools.TestUtilities.UI.14.0, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
<HintPath>..\..\..\..\NugetPackages\Microsoft.VisualStudioTools.TestUtilities.14.0.0.0.0\lib\net45\Microsoft.VisualStudioTools.TestUtilities.UI.14.0.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="UIAutomationClient" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="RConstants.cs" />
<Compile Include="UITests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\PTVS\Common\Tests\Utilities.UI\TestUtilities.UI.csproj">
<Project>{e8150ebc-6b62-40bf-bf91-1dc60149b530}</Project>
<Name>TestUtilities.UI</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
12 changes: 12 additions & 0 deletions src/UnitTests/UI/Microsoft.UI.Test/RConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.UI.Test {
public class RConstants {
public const string TemplateLanguageName = "R";
public const string ProjectTemplate_EmptyProject = "EmptyProject.zip";
}
}
52 changes: 52 additions & 0 deletions src/UnitTests/UI/Microsoft.UI.Test/UITests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System;
using System.IO;
using System.Linq;
using EnvDTE80;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudioTools.TestUtilities.UI;

namespace Microsoft.UI.Test {
[TestClass]
public class UITests {
[TestMethod, Priority(1)]
[HostType("VSTestHost"), TestCategory("Installed")]
public void CreateNewScript() {
using (var app = new VisualStudioApp()) {
var project = app.CreateProject(
RConstants.TemplateLanguageName, RConstants.ProjectTemplate_EmptyProject,
System.IO.Path.GetTempPath(), "RTestProject");
app.OpenSolutionExplorer().SelectProject(project);
using (var newItem = NewItemDialog.FromDte(app)) {
AutomationWrapper.Select(newItem.ProjectTypes.FindItem("R Script"));
newItem.FileName = "my-script.r";
newItem.OK();
}

var document = app.GetDocument("my-script.r");
document.SetFocus();
document.Type("2 -> a");
Assert.AreEqual("2 -> a# R Script", document.Text);
}
}

[TestMethod, Priority(1)]
[HostType("VSTestHost"), TestCategory("Installed")]
public void VerifyTemplateDirectories() {
var languageName = RConstants.TemplateLanguageName;
using (var app = new VisualStudioApp()) {
var sln = (Solution2)app.Dte.Solution;

foreach (var templateName in new[] {
RConstants.ProjectTemplate_EmptyProject,
}) {
var templatePath = sln.GetProjectTemplate(templateName, languageName);
Assert.IsTrue(
File.Exists(templatePath) || Directory.Exists(templatePath),
string.Format("Cannot find template '{0}' for language '{1}'", templateName, languageName)
);
Console.WriteLine("Found {0} at {1}", templateName, templatePath);
}
}
}
}
}
4 changes: 4 additions & 0 deletions src/UnitTests/UI/Microsoft.UI.Test/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.VisualStudioTools.TestUtilities.14.0" version="0.0.0" targetFramework="net46" />
</packages>

0 comments on commit 29111cc

Please sign in to comment.