Skip to content

Sending Data to the Test Server

Tom Longhurst edited this page Nov 25, 2021 · 7 revisions

Note: Only tests run via the BDTest syntax will be sent to the test report server.

Given(...)
.When(...)
.Then(...)
.BDTest();

At the end of all of your tests being run, you need to call the static method BDTestReportServer.SendDataAndGetReportUriAsync(Uri, BDTestRunDescriptor)

That's it!

In NUnit, that involves just having a class in your test assembly that looks like this:

    [SetUpFixture]
    public class GlobalTestTearDown
    {
        [OneTimeTearDown]
        public async Task SendBDTestReportServerData()
        {
            var reportUri = await BDTestReportServer.SendDataAndGetReportUriAsync(
                        new Uri("https://myexamplebdtestserver.com"),
                        new BDTestRunDescriptor
                        {
                            Tag = "API Acceptance Tests",
                            BranchName = GetCurrentBranchName(), // Can get your build server to pass this in as an EnvironmentVariable;
                            Environment = "Pre-Production"
                        });

            Console.WriteLine($"BDTest Report Server Results: {reportUri}");
        }
    }

After your tests have finished, simply navigate to your test report server, and your latest test results will show on the homepage.

Clone this wiki locally