We have a series of functional tests which test that our endpoints are returning a 200 status code and return a file with a content type of application/pdf.
When running the tests individualy the all pass however when clicking "run all tests" we find that tests fail at random. So sometimes 2/10 will pass other times 9/10 etc.
A null reference exception is returned with the addition of "CancelProcessingException: An error occurred while evaluating the report parameters. Report source cannot be processed. Check the InnerException for more information." unfrtunatley the inner exception is also null.
An example of one of our functional tests is as below:
[Fact]
public async Task Post_valid_data_returns_success_and_correct_content_type()
{
// Given
var client = _factory.CreateClient();
// When
var response = await client.PostAsJsonAsync(BASE_URL,
new ReportDataExample().GetExample());
// Then
await response.EnsureSuccessStatusCode();
response.Content.Headers.ContentType.ToString().Should().Be("application/pdf");
}
I have attached a copy of the full error including stack trace. If anyone could advise on what the issue may be and/or a possible solution it would be greatly appreciated.