Skip to content

Support for writing Isolated Integration tests for Xperience Mvc applications.

License

Notifications You must be signed in to change notification settings

BizStream/xperience-mvc-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xperience-mvc-testing License

Support for writing Isolated tests for Xperience Mvc applications, based on the Microsoft.AspNetCore.Mvc.Testing & Kentico.Xperience.Libraries.Tests frameworks.

For more information on Mvc Integration testing and automated testing in Kentico, see:

Usage

  • Install the package into your Xperience Mvc Test project:

Kentico versions <13.0.19 are not supported when targeting net5.0, due to a bug within Kentico.Xperience.Libraries.Tests.

dotnet add package BizStream.Kentico.Xperience.AspNetCore.Mvc.Testing

OR

<PackageReference Include="BizStream.Kentico.Xperience.AspNetCore.Mvc.Testing" Version="x.x.x" />
  • Implement a TestFixture derived from AutomatedTestWithIsolatedWebApplication<TStartup>:
[TestFixture( Category = "IsolatedMvc" )]
public class ExampleIsolatedWebTests : AutomatedTestWithIsolatedWebApplication<ExampleApp.Startup>
{

    [Test]
    public async Task Get_Root_ShouldReturnSuccessAndContent(  )
    {
        var response = await Client.GetAsync( "/" );
        response.EnsureSuccessStatusCode();

        var content = await response.Content.ReadAsStringAsync();
        Assert.IsFalse( string.IsNullOrWhiteSpace( content ) );
    }

}

About

Support for writing Isolated Integration tests for Xperience Mvc applications.

Resources

License

Stars

Watchers

Forks