Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Remove TFM parsing from xunit test target #160

Merged
merged 2 commits into from
Feb 16, 2017
Merged

Conversation

natemcmaster
Copy link
Contributor

Requires update to projects that use .NET Framework in test projects. These should be updated to only include .NET Framework when building/testing on Windows.

@natemcmaster
Copy link
Contributor Author

I made the changes affected repos to ensure net451 tests are only compiled on Windows. Will push once this is merged

@natemcmaster
Copy link
Contributor Author

❌ blocked. Conditional TargetFrameworks properties cause VS to explode

image

@natemcmaster
Copy link
Contributor Author

When this dotnet/project-system#1444 makes it into a build, we can return to conditioning TargetFrameworks on OS.

@natemcmaster
Copy link
Contributor Author

🔔 Updated and rebased. Ready for review.

<Target Name="TestProjects">

<ItemGroup Condition="'@(ProjectsToTest)'==''">
<!-- put unit test projects ahead of functional tests -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually have this as a convention? Tests -> Functional? Otherwise this is kinda misleading.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plus we don't super care about ordering. Ideally we should try and these in parallel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something EF has requested. Running unit tests first to catch errors early is nice, esp when functional tests can take a long time to run.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we explicit about it - requiring functional tests to include the term FunctionalTests? Alternatively have repo.props determine order if it's necessary

<!-- put unit test projects ahead of functional tests -->
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.Tests.csproj" Exclude="$(ExcludeFromTest)" />
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.Test.csproj" Exclude="$(ExcludeFromTest)" />
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.csproj" Exclude="@(ProjectsToTest);$(ExcludeFromTest)" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this suffice? Also, why not make ExcludeFromTest an item group?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And item group might be better. I ran into this dotnet/msbuild#1576 which means setting ExcludeFromTest in repo.targets correctly is not easy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, nvm. ItemGroups and remove syntax suffer from the same issue.

<!-- TODO if VS Test doesn't make minimal output the default log setting, we can set that here. cref https://github.com/Microsoft/vstest/issues/301 -->
<VSTestLogger Condition=" '$(VSTestLogger)'=='' AND '$(TEAMCITY_VERSION)' != '' ">trx</VSTestLogger>
<IgnoreFailingTestProjects>false</IgnoreFailingTestProjects>
<ContinueOnTestError Condition="'$(KOREBUILD_IGNORE_DOTNET_TEST_EXIT_CODE)' == '1'">true</ContinueOnTestError>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be IgnoreFailingTestProjects? ContinueOnTestError isn't used elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good catch. Missed that rename.

<SharedSourceDirectories Remove="@(ExcludeSharedSourceDirectories)" />

<!-- put unit test projects ahead of functional tests -->
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.Tests.csproj" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<ItemGroup Condition="'@(ProjectsToTest)'==''">
  <_FunctionalTests Include="$(RepositoryRoot)test\*FunctionalTest*.csproj" />
  <ProjectsToTest Include="$(RepositoryRoot)test\*Test*.csproj" Exclude="@(_FuctionalTests)" />
  <ProjectsToTest Include="@(_FunctionalTests)"  />
 ...
</ItemGroup>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Although, the thinking behind not doing Condition="'@(ProjectsToTest)'==''" is that the most common scenario here is that we will want to exclude a project from testing ExcludeFromTest that was picked up by default globs. Redefining the default globs is cumbersome.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we could add it if we need it later on.

@natemcmaster natemcmaster merged commit 6ba347c into feature/msbuild Feb 16, 2017
@natemcmaster natemcmaster deleted the namc/test branch February 16, 2017 17:13
natemcmaster pushed a commit to aspnet/Configuration that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/Hosting that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/ServerTests that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/Localization that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/Diagnostics that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/WebSockets that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/IISIntegration that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/SignalR that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/EntityFramework.Tools that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/Security that referenced this pull request Feb 16, 2017
natemcmaster pushed a commit to aspnet/BuildTools that referenced this pull request Feb 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants