Skip to content

[Helix] WebApplicationFactory test needs additional publish files to work on helix #7986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
HaoK opened this issue Feb 27, 2019 · 3 comments
Closed
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Fixed The bug or enhancement requested in this issue has been checked-in! task
Milestone

Comments

@HaoK
Copy link
Member

HaoK commented Feb 27, 2019

Currently all of these kinds of tests are disabled on helix because they need to include additional things for these style tests to work

Helix tests are basically just doing a dotnet publish, copying the publish folder over as is, and run via dotnet vstest on helix machines.

These kinds of tests appear to need extra things like deps files, as well as potentially things like related views assemblies, for example:

 System.IO.FileNotFoundException : Related assembly 'Microsoft.AspNetCore.Identity.UI.Views.V3' specified by assembly 'Microsoft.AspNetCore.Identity.UI' could not be found in the directory C:\temp\identity. Related assemblies must be co-located with the specifying assemblies.
Stack Trace:
   at Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly assembly, Boolean throwOnError, Func`2 fileExists, Func`2 loadFile) in C:\Github\AspNetCore\src\Mvc\Mvc.Core\src\ApplicationParts\RelatedAssemblyAttribute.cs:line 104
   at Microsoft.AspNetCore.Mvc.ApplicationParts.RelatedAssemblyAttribute.GetRelatedAssemblies(Assembly assembly, Boolean throwOnError) in C:\Github\AspNetCore\src\Mvc\Mvc.Core\src\ApplicationParts\RelatedAssemblyAttribute.cs:line 53
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.<>c__DisplayClass3_0.<AddRelatedParts>b__0(ApplicationPartManager partManager) in C:\Github\AspNetCore\src\Identity\UI\src\IdentityBuilderUIExtensions.cs:line 79
   at Microsoft.Extensions.DependencyInjection.MvcCoreMvcBuilderExtensions.ConfigureApplicationPartManager(IMvcBuilder builder, Action`1 setupAction) in C:\Github\AspNetCore\src\Mvc\Mvc.Core\src\DependencyInjection\MvcCoreMvcBuilderExtensions.cs:line 108
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddRelatedParts(IdentityBuilder builder, UIFramework framework) in C:\Github\AspNetCore\src\Identity\UI\src\IdentityBuilderUIExtensions.cs:line 74
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder, UIFramework framework) in C:\Github\AspNetCore\src\Identity\UI\src\IdentityBuilderUIExtensions.cs:line 53
   at Microsoft.AspNetCore.Identity.IdentityBuilderUIExtensions.AddDefaultUI(IdentityBuilder builder) in C:\Github\AspNetCore\src\Identity\UI\src\IdentityBuilderUIExtensions.cs:line 33
   at Microsoft.Extensions.DependencyInjection.IdentityServiceCollectionUIExtensions.AddDefaultIdentity[TUser](IServiceCollection services, Action`1 configureOptions) in C:\Github\AspNetCore\src\Identity\UI\src\IdentityServiceCollectionUIExtensions.cs:line 56

Basically what we need is a self contained directory that has everything needed to be able to run the tests after publish. Hopefully this is just copying a few additional files from the bin directory?

@mkArtakMSFT @javiercn @pranavkm

@HaoK
Copy link
Member Author

HaoK commented Feb 27, 2019

Projects affected by this include:

src\Azure\AzureAD\test\FunctionalTests\Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests.csproj
src\Identity\test\Identity.FunctionalTests\Microsoft.AspNetCore.Identity.FunctionalTests.csproj
src\Mvc\test\Mvc.FunctionalTests\Microsoft.AspNetCore.Mvc.FunctionalTests.csproj

@javiercn
Copy link
Member

Functional tests are not designed to work against published content. There is extensibility to enable this scenario:

  • You'll have to define some sort of layout for the wwwroots of the targeted projects in the published output. For example:
    • publish\Websites\BasicWebSite\wwwroot
    • publish\Websites\FilesWebSite\wwwroot
  • You'll have to define assembly level attributes WebApplicationFactoryContentRootAttribute for all the attributes.
    • WebApplicationFactoryContentRootAttribute supports relative paths (I believe from the executing assembly).
  • You'll have to copy the deps file for each of the websites into the published content.

I suggest adding an AssemblyInfo.Helix.cs to Functionaltests for defining the attributes and a FunctionalTests.Helix.targets file for defining the MSBuild for doing the file copy.

After that the tests should work provided that shadow copying is disabled.

@Eilon Eilon added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Mar 3, 2019
@danroth27 danroth27 added the task label Apr 3, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview6 milestone Apr 4, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 3.0.0-preview6, 3.0.0 May 1, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 3.0.0, Backlog Aug 14, 2019
@HaoK
Copy link
Member Author

HaoK commented Feb 9, 2021

Addressed by #27296

@HaoK HaoK closed this as completed Feb 9, 2021
@HaoK HaoK added the ✔️ Resolution: Fixed The bug or enhancement requested in this issue has been checked-in! label Feb 9, 2021
@HaoK HaoK modified the milestones: Backlog, 6.0-preview2 Feb 9, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates ✔️ Resolution: Fixed The bug or enhancement requested in this issue has been checked-in! task
Projects
None yet
Development

No branches or pull requests

6 participants