crashtestdev
02/29/2024, 8:41 AMUmbracoTestServerBase
test class https://docs.umbraco.com/umbraco-cms/implementation/integration-testing#testing-from-controller-to-database, there's a UmbracoApiController
that I wanted to run an integration test on, following the docs, I wrote:
c#
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
public class CustomApiControllerTest: UmbracoTestServerTestBase
{
[Test]
public async Task EnsureSuccessStatusCode()
{
var url = PrepareApiControllerUrl<CustomApiController>(x => x.Get());
var response = await Client.GetAsync(url);
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
}
}
The Get()
endpoint just returns Ok()
, however I am repeatedly getting a 404 not found error, running the test in debug mode, it doesn't appear that the controller endpoint is being hit at all, is there some steps required for UmbracoTestServerTestBase to find the controllers in a project?