Skip to content

Commit

Permalink
Re-organizing solution file layout for ODL master branch (#907)
Browse files Browse the repository at this point in the history
Re-organizing solution file layout for ODL master branch
- Renaming solutions from Microsoft.(Test.)OData.* to OData.Product/Tests to reduce name size
- Creating new light solutions for each supported framework (Net35, Net45, and NetStandard) and corresponding unit tests.
- Reducing number of solutions by moving most tests to Microsoft.OData.Full.sln, which has been renamed to OData.Tests.E2E.sln. This solution builds on Net45
- There are two .NetStandard solutions. The product one contains only the product, and the test one contains both the product and unit tests. The product-only solution will eventually be removed once ODL migrates to Visual Studio 2017; this is a current workaround to pre-released version of .NET Core tooling in VS2015.
- Fixing bug in test where dashes in a hostname causes SQL statements to not execute properly. Replacing any '-' (there shouldn't be any other special characters) found in hostnames with '_'.
- Updating docs to reflect solution changes
  • Loading branch information
AlanWong-MS committed Jul 21, 2017
1 parent a282257 commit 2b8e1fc
Show file tree
Hide file tree
Showing 66 changed files with 1,363 additions and 1,502 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ These are the recommended steps to create a pull request:

### Test specification

Now we have introduced the modern xUnit test projects for OData.NET (in `Microsoft.OData.Lite.sln`). **We strongly recommend you to write all new tests with xUnit. And it would be very kind of you to help migrate some existing MSTest cases when you modify them.** Those xUnit projects all adopt the same new intuitive structure that helps contributors to find the corresponding tests for the given product code very easily. Here are some rules to follow when you are organizing the test code:
Now we have introduced the modern xUnit test projects for OData.NET (in `OData.Net45.sln`, or simply launch the `OData.sln` shortcut at the root level folder). **We strongly recommend you to write all new tests with xUnit. And it would be very kind of you to help migrate some existing MSTest cases when you modify them.** Those xUnit projects all adopt the same new intuitive structure that helps contributors to find the corresponding tests for the given product code very easily. Here are some rules to follow when you are organizing the test code:

- **Project name correspondence** (`X -> X.Tests`). For instance, all the test code of the `Microsoft.OData.Edm` project should be placed in the `Microsoft.OData.Edm.Tests` project. Path and file name correspondence. (`X/Y/Z/A.cs -> X.Tests/Y/Z/ATests.cs`). For example, the test code of the `CsdlSemanticsEntityContainer` class (in the `Microsoft.OData.Edm/Csdl/Semantics/CsdlSemanticsEntityContainer.cs` file) should be placed in the `Microsoft.OData.Edm.Tests/Csdl/Semantics/CsdlSemanticsEntityContainerTests.cs` file.
- **Namespace correspondence** (`X.Tests/Y/Z -> X.Tests.Y.Z`). The namespace of the file should strictly follow the path. For example, the namespace of the `CsdlSemanticsEntityContainerTests.cs` file should be `Microsoft.OData.Edm.Tests.Csdl.Semantics`.
Expand Down
Binary file added OData.sln.lnk
Binary file not shown.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,21 @@ Note: The project T4CrossPlatformTests.WindowsStore.csproj will not be loaded un

### 3.1 Building and Testing in Visual Studio

Simply open the solution files under 'sln' folder and build them in Visual Studio 2013 or 2015.
Simply open the shortcut `OData.sln` at the root level folder to launch a solution that contains the product source and relevant unit tests. Should you see the need to modify or add additional tests, please see the `sln` folder for the whole set of solution files.

Here is the usage of each solution file:
Here is the usage of each solution file (the `OData.sln` shortcut opens the one marked default):

- Microsoft.OData.Lite.sln - Product source and minimal functional tests. _Recommended_ for doing general bugfix and feature development. It is built with .Net Framework Portable version 4.0.
- Microsoft.OData.Full.sln - Product source and full functional tests (excluding test cases in Lite and E2E solution). Used to _fully_ test your code.
- Microsoft.OData.E2E.sln - Product source and end-to-end tests.
- Microsoft.OData.Net35.sln - Solution with product source built with .Net Framework version 3.5.
- Microsoft.OData.Net45.sln - Solution with product source built with .Net Framework version 4.5.
- Microsoft.OData.Portable45.sln - Solution with product source built with .Net Framework Portable version 4.5.
- Microsoft.OData.Performance.sln - Product source and performance tests built with .Net Framework version 4.6.
- Microsoft.OData.CodeGen.sln - Source and tests for OData T4 client code generator.
- OData.CodeGen.sln - OData T4 client code generator product source and tests.
- OData.Net35.sln - Product source built with .Net Framework 3.5.
- OData.Net45.sln (default) - Product source built with .Net Framework Portable 4.5 and contains corresponding unit tests. _Recommended_ for doing general bug fixes and feature development.
- OData.NetStandard.sln - Product source built with .Net Standard 1.1.
- OData.Tests.E2E.sln - Product source built with .Net Framework 4.5. Contains exhaustive list of tests (unit, E2E, and regression) and not intended to be opened frequently. The `Build.cmd` script will run all tests from here and this solution is used to _fully_ test your code.
- OData.Tests.NetStandard.sln - Product source built with .Net Standard 1.1 and contains corresponding unit tests written in .NET Core. Note that once OData has migrated to VS2017, this solution will replace OData.NetStandard.sln (and take its name) to reduce the number of solutions.
- OData.Tests.Performance.sln - Product source and performance tests built with .Net Framework version 4.6.
- OData.Tests.WindowsApps.sln - Product source and test harnesses written in Windows Portable and Windows Phone 8.1.
- OData.Tests.WindowsStore.VS2013.sln - Product source and test harnesses written in Windows Store 8.0. Note: this solution requires VS2013 as newer versions don't support this platform anymore; however, there is no hard requirement for you to have VS2013 on your machine and the build script will skip this solution if VS2013 is not installed.

Each solution contains some test projects. Please open it, build it and run all the tests in the test explorer. For running tests within Microsoft.OData.Full.sln and Microsoft.OData.E2E.sln, you need to open Visual Studio IDE as **_Administrator_** so that the test services can be started properly.
Each solution contains some test projects. Please open it, build it and run all the tests in the test explorer. For running tests within OData.Tests.E2E.sln, you need to open Visual Studio IDE as **_Administrator_** so that the test services can be started properly.

### 3.2 One-click build and test script in command line

Expand Down
25 changes: 12 additions & 13 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $NUGETEXE = $ENLISTMENT_ROOT + "\sln\.nuget\NuGet.exe"
$NUGETPACK = $ENLISTMENT_ROOT + "\sln\packages"
$XUNITADAPTER = "/TestAdapterPath:" + $NUGETPACK + "\xunit.runner.visualstudio.2.1.0\build\_common"

$NugetRestoreSolutions = "Microsoft.OData.DotNetStandard.sln"
$NugetRestoreSolutions = "OData.NetStandard.sln"

$ProductDlls = "Microsoft.OData.Client.dll",
"Microsoft.OData.Core.dll",
Expand Down Expand Up @@ -501,33 +501,32 @@ Function BuildProcess
{
rm $BUILDLOG
}
RunBuild ('Microsoft.OData.Lite.sln')

RunBuild ('OData.Net45.sln')

if ($TestType -ne 'Quick')
{
RunBuild ('Microsoft.OData.Full.sln')
RunBuild ('Microsoft.OData.Net35.sln')
RunBuild ('Microsoft.OData.E2E.Portable.sln')
RunBuild ('Microsoft.Test.OData.Tests.Client.Portable.Desktop.sln')
RunBuild ('Microsoft.Test.OData.Tests.Client.Portable.WindowsPhone.sln')
# OData.Tests.E2E.sln contains the product code for Net45 framework and a comprehensive list of test projects
RunBuild ('OData.Tests.E2E.sln')
RunBuild ('OData.Net35.sln')
RunBuild ('OData.NetStandard.sln')
RunBuild ('OData.CodeGen.sln')
RunBuild ('OData.Tests.WindowsApps.sln')
# Windows Store builds 8.0 apps which is needed to meet PCL111/.NET Standard 1.1 criteria
# Because VS2015 doesn't support 8.0 apps, we need to use VS2013. Skip if VS2013 not installed.
if([System.IO.File]::Exists($VS12MSBUILD) -And [System.IO.File]::Exists($VS12XAMLTARGETFILE))
{
RunBuild ('Microsoft.Test.OData.Tests.Client.Portable.WindowsStore.sln') -vsToolVersion '12.0'
RunBuild ('OData.Tests.WindowsStore.VS2013.sln') -vsToolVersion '12.0'
}
else
{
Write-Host 'Skipping Microsoft.Test.OData.Tests.Client.Portable.WindowsStore.sln because VS2013 not installed or `
Write-Host 'Skipping OData.Tests.WindowsStore.VS2013.sln because VS2013 not installed or `
missing Microsoft.Windows.UI.Xaml.CSharp.targets for VS2013'
}
RunBuild ('Microsoft.OData.CodeGen.sln')
RunBuild ('Microsoft.OData.E2E.sln')

# Requires VS2015 (14.0) due to .NET Core test projects
# RunBuild ('Microsoft.Test.OData.DotNetStandard.sln')
# RunBuild ('OData.Tests.NetStandard.sln')
# CopyNetCoreOutput

}

Write-Host "Build Done" -ForegroundColor $Success
Expand Down
Loading

0 comments on commit 2b8e1fc

Please sign in to comment.