Skip to content

lars-erik/umbraco-unit-testing-samples

Repository files navigation

Test Examples for Umbraco implementors

Schema

You'll want a schema for most of your tests.
There are several options:

  • Using Builders
    • Most of the tests in this repo has setup methods using builders
  • Importing uSync files
    • [TODO] Import your website usync files in one go

See the Creating_Content test for an example.

Services

Most of the Umbraco services work out of the box with UmbracoIntegrationTest.
All tests in this example repo use a database with schema per fixture.

SurfaceControllers

A lot of Umbraco implementations utilize SurfaceController to process form posts.
Very often they interact with the "current page".
The setup and extensions used in the CTA_Form example is all you need to set up a "current page". When that's done, you can use CurrentPage, RedirectToCurrentPage etc.

Data editors

You'll want to test your editors with JSON from your client code.
The best way to fully test an editor is to inherit UmbracoTestServerTestBase.
See the DataEditor_Via_Hosted_Controller tests for an example.

Rendering

Rendering is the slowest integration test you can do, but works "OOTB" with UmbracoTestServerTestBase.
See the Rendring_Page_Via_Hosted_Url tests for an example.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published