Class IZagalaSpecBDDExporter#

Inheritance Relationships#

Derived Types#

Class Documentation#

class IZagalaSpecBDDExporter#

Common interface for all BDD format exporters.

Concrete implementations: FZagalaSpecGherkinExporter — Gherkin / SpecFlow (.feature) FZagalaSpecFitNesseExporter — FitNesse Script Table wiki markup (.wiki) FZagalaSpecRobotFrameworkExporter — Robot Framework (.robot) FZagalaSpecGaugeExporter — Gauge (.spec)

Default ExportToFile: Calls Export(), then writes the result as UTF-8 without BOM. Logs an error and returns false if the file cannot be written. Concrete exporters inherit this behaviour and do not need their own ExportToFile bodies.

ExtractTagLeafName: Shared utility that returns the segment after the last dot in a GameplayTag name (e.g. “ZagalaSpec.Login.ValidLogin” -> “ValidLogin”). Used by exporters to derive leaf metadata (e.g. Gauge tags: line).

NameOf: Shared utility that returns the full GameplayTag name of a feature or scenario (e.g. “ZagalaSpec.Login.ValidLogin”). Falls back to UObject::GetName() when the tag is invalid or the object is not a recognised type. Returns an empty string for null/invalid objects.

Subclassed by FZagalaSpecFitNesseExporter, FZagalaSpecGaugeExporter, FZagalaSpecGherkinExporter, FZagalaSpecRobotFrameworkExporter, FZagalaSpecZagalaSpecExporter

Public Functions

virtual ~IZagalaSpecBDDExporter() = default#
FString Export(const UObject *Feature, EZagalaSpecExportFormat Format) const#

Export a feature to a format-specific text string.

Default implementation routes through the .zagalaspec intermediate:

  1. Creates an FZagalaSpecFeatureIR IR from the feature.

  2. Delegates to ExportFromIR().

Parameters:
  • Feature – Feature object to export.

  • Format – Target export format (FitNesse/Robot exporters may ignore this).

Returns:

The exported text, or an empty string if Feature is invalid.

bool ExportToFile(const UObject *Feature, const FString &FilePath, EZagalaSpecExportFormat Format) const#

Export and write to a file.

UTF-8 without BOM encoding. Returns true on success, false if Export() returns empty or the file cannot be written.

Parameters:
  • Feature – Feature object to export.

  • FilePath – Destination file path.

  • Format – Target export format.

Returns:

True if the file was written.

virtual FString ExportFromIR(const FZagalaSpecFeatureIR &ImportedFeature, EZagalaSpecExportFormat Format) const = 0#

Export an FZagalaSpecFeatureIR IR struct to a format-specific text string.

All concrete exporters implement this as the primary conversion path. The base Export() default routes through this method via the .zagalaspec intermediate.

Parameters:
  • ImportedFeature – Feature IR to export.

  • Format – Target export format.

Returns:

The exported text.

virtual FString GenerateTextFeatureFromIR(const FZagalaSpecFeatureIR &ImportedFeature, EZagalaSpecExportFormat &Format) const = 0#

Generate the complete format-specific text of a feature IR.

Parameters:
  • ImportedFeature – Feature IR to convert.

  • Format – Target export format.

Returns:

The generated feature text.

virtual FString GenerateTextScenariosFromIR(const FZagalaSpecFeatureIR &ImportedFeature) const = 0#

Generate the format-specific text of every scenario in a feature IR.

Parameters:

ImportedFeature – Feature IR whose scenarios are converted.

Returns:

The concatenated scenario text.

virtual FString GenerateTextStepFromIR(const FZagalaSpecStepIR &Step) const = 0#

Generate the format-specific text of a single step IR.

Parameters:

Step – Step IR to convert.

Returns:

The generated step text.

Public Static Functions

static FZagalaSpecFeatureIR CreateIRFromFeature(const UObject *Feature)#

Creates the Intermediate Representation of a feature.

Parameters:

Feature – Feature object implementing IZagalaSpecDescriptor.

Returns:

The feature IR, or a default IR if Feature is invalid.

static TArray<FZagalaSpecStepIR> CreateIRSharedContextExtensionsFromFeature(const UObject *Feature)#

Creates the Intermediate Representation of shared context extensions in a feature.

Parameters:

Feature – Feature object to read.

Returns:

One step IR per shared context extension input.

static TArray<FZagalaSpecScenarioIR> CreateIRScenariosFromFeature(const UObject *Feature)#

Creates the Intermediate Representation of scenarios in a feature.

Parameters:

Feature – Feature object implementing IZagalaSpecFeature.

Returns:

One scenario IR per valid scenario; empty if Feature is invalid.

static FZagalaSpecScenarioIR CreateIRScenario(const UObject *Scenario)#

Creates the Intermediate Representation of a scenario.

Parameters:

Scenario – Scenario object implementing IZagalaSpecDescriptor.

Returns:

The scenario IR, or a default IR if Scenario is invalid.

static TArray<FZagalaSpecStepIR> CreateIRContextExtensionsFromScenario(const UObject *Scenario)#

Creates the Intermediate Representation of context extensions in a scenario.

Parameters:

Scenario – Scenario object to read.

Returns:

One step IR per context extension input.

static TArray<FZagalaSpecStepIR> CreateIRStepsFromScenario(const UObject *Scenario)#

Creates the Intermediate Representation of steps (expectations) in a scenario.

Parameters:

Scenario – Scenario object to read.

Returns:

One step IR per expectation input.

static FZagalaSpecStepIR CreateIRFromStepString(const FString &StepString)#

Creates the Intermediate Representation of a step from a string.

Parameters:

StepString – Step text used as both raw and parsed text.

Returns:

The step IR.

static bool IsIncludedInTests(const UObject *Object)#

Checks whether a feature or scenario is included in tests or not (enabled/disabled).

Parameters:

Object – Object implementing IZagalaSpecTestabilityIndicator.

Returns:

True if included in tests; false if excluded or Object is invalid.

static FString ExtractTagLeafName(const FGameplayTag &Tag)#

Extract the leaf segment of a GameplayTag name (the part after the last dot).

Returns an empty string if the tag is not valid.

Parameters:

Tag – GameplayTag to read.

Returns:

The leaf segment of the tag name.

static FString GetStepInputForExpectation(const UObject *Step)#

Returns the plain text to pass to FZagalaSpecStepPhaseResolver::Resolve for a step object.

For objects implementing IZagalaSpecExportableStep: returns GetAsText(). For any other valid object: returns GetClass()->GetDisplayNameText().ToString(). Returns an empty string for invalid/null objects (caller should skip the step).

Parameters:

Step – Expectation step object.

Returns:

The step input text.

static FString GetInputForContextExtension(const UObject *Extension)#

Returns the plain text to pass to FZagalaSpecStepPhaseResolver::Resolve for a context extension.

For objects implementing IZagalaSpecExportableStep: returns GetAsText(). For any other valid object: returns GetClass()->GetDisplayNameText().ToString(). Returns an empty string for invalid/null objects (caller should skip the step).

Parameters:

Extension – Context extension object.

Returns:

The extension input text.

static TArray<FString> CollectScenarioExtensionInputs(const UObject *Scenario)#

Collect the input text of every context extension of a scenario (see GetInputForContextExtension).

Returns an empty array if the scenario is invalid.

Parameters:

Scenario – Scenario object implementing IZagalaSpecScenarioInterface.

Returns:

Non-empty input texts of the scenario’s context extensions.

static TArray<FString> CollectScenarioExpectationInputs(const UObject *Scenario)#

Collect the input text of every expectation of a scenario (see GetStepInputForExpectation).

Objects implementing IZagalaSpecExportableStep contribute GetAsText(); others contribute their class display name.

Parameters:

Scenario – Scenario object implementing IZagalaSpecScenarioInterface.

Returns:

Non-empty input texts of the scenario’s expectations; empty if Scenario is invalid.

static TArray<FString> CollectSharedExtensionInputs(const UObject *Feature)#

Collect the input text of every shared context extension of a feature (see GetInputForContextExtension).

Empty inputs are skipped. Returns an empty array when the feature is invalid or has no shared extensions.

Parameters:

Feature – Feature object implementing IZagalaSpecFeature.

Returns:

Non-empty input texts of the feature’s shared context extensions.

static FString NameOf(const UObject *Object)#

Returns the full GameplayTag name of an object that implements IZagalaSpecDescriptor (e.g.

a feature or scenario) (e.g. “ZagalaSpec.Login.ValidLogin”). When the tag is invalid the UObject asset name is returned as a fallback. Returns an empty string for null/invalid objects.

Parameters:

Object – Object to name.

Returns:

The full tag name, object name, or an empty string.