Skip to content

Commit 92cc12e

Browse files
committed
Add message dumping contextual information when failing to load inputs from test suite
1 parent d15993f commit 92cc12e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Solutions/Corvus.Json.Specs/Steps/JsonSchemaSteps.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ namespace Steps
99
using System.Threading.Tasks;
1010
using Corvus.Json;
1111
using Drivers;
12+
13+
using Microsoft.Extensions.Configuration;
14+
1215
using NUnit.Framework;
1316
using TechTalk.SpecFlow;
1417

@@ -28,18 +31,21 @@ public class JsonSchemaSteps
2831
private readonly FeatureContext featureContext;
2932
private readonly ScenarioContext scenarioContext;
3033
private readonly IJsonSchemaBuilderDriver driver;
34+
private readonly IConfiguration configuration;
3135

3236
/// <summary>
3337
/// Initializes a new instance of the <see cref="JsonSchemaSteps"/> class.
3438
/// </summary>
3539
/// <param name="featureContext">The current feature context.</param>
3640
/// <param name="scenarioContext">The current scenario context.</param>
3741
/// <param name="driver">The json schema builder driver.</param>
38-
public JsonSchemaSteps(FeatureContext featureContext, ScenarioContext scenarioContext, IJsonSchemaBuilderDriver driver)
42+
/// <param name="configuration">Configuration settings.</param>
43+
public JsonSchemaSteps(FeatureContext featureContext, ScenarioContext scenarioContext, IJsonSchemaBuilderDriver driver, IConfiguration configuration)
3944
{
4045
this.featureContext = featureContext;
4146
this.scenarioContext = scenarioContext;
4247
this.driver = driver;
48+
this.configuration = configuration;
4349
}
4450

4551
/// <summary>
@@ -71,7 +77,9 @@ public void GivenTheSchemaAt(string referenceFragment)
7177
public async Task GivenTheInputDataAt(string referenceFragment)
7278
{
7379
JsonElement? element = await this.driver.GetElement(this.scenarioContext.Get<string>(InputJsonFileName), referenceFragment).ConfigureAwait(false);
74-
Assert.NotNull(element);
80+
Assert.NotNull(
81+
element,
82+
$"Failed to load input data at {this.scenarioContext.Get<string>(InputJsonFileName)}, ref {referenceFragment}, jsonSchemaBuilder201909DriverSettings:testBaseDirectory: '{this.configuration["jsonSchemaBuilder201909DriverSettings:testBaseDirectory"]}', jsonSchemaBuilder202012DriverSettings: '{this.configuration["jsonSchemaBuilder202012DriverSettings:testBaseDirectory"]}' CWD: '{Environment.CurrentDirectory}'");
7583
this.scenarioContext.Set(referenceFragment, InputDataPath);
7684
this.scenarioContext.Set(element.Value, InputData);
7785
}

azure-pipelines.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ resources:
1313
type: github
1414
name: endjin/Endjin.RecommendedPractices.AzureDevopsPipelines.GitHub
1515
endpoint: corvus-dotnet-github
16-
ref: refs/heads/feature/checkout-submodules
1716

1817
jobs:
1918
- template: templates/build.and.release.scripted.yml@recommended_practices

0 commit comments

Comments
 (0)