Skip to content

Use Case: removing Given/Then with a related helper method which name is not a one-to-one match with Given/Then description #131

@lvanvugt

Description

@lvanvugt

Placeholder text.
This Use Case might still need to be detailed better (like providing a flowchart).

Issue to tackle

When we have a Given/Then tag with a description that does not related one-to-one with the related helper method we might want to implement logic to allow removal of both tag and helper method. At te moment it will only remove the Given/Then.

Example of current behaviour

Making use of the existing test codeunit example TestObjectWithTwoFeatures.Codeunit.al, where we remove from TestFunction2 Given (or Then).

    [Test]
    procedure TestFunction2()
    // [FEATURE] Feature 1
    begin
        // [SCENARIO 0002] Test function 2
        // [Given] Valid Given        
        CreateValidGiven_2();
        // [When] Valid When        
        ValidWhen_2();
        // [Then] Valid Then        
        VerifyValidThen_2();
    end;

The result will be (when removing Given):

    [Test]
    procedure TestFunction2()
    // [FEATURE] Feature 1
    begin
        // [SCENARIO 0002] Test function 2
        // [When] Valid When        
        ValidWhen_2();
        // [Then] Valid Then        
        VerifyValidThen_2();
    end;

But the related helper method CreateValidGiven_2 will not be removed. Doing the same for TestFunction1

    [Test]
    procedure TestFunction1()
    // [FEATURE] Feature 1
    begin
        // [SCENARIO 0001] Test function 1
        // [Given] Valid Given        
        CreateValidGiven();
        // [When] Valid When        
        ValidWhen();
        // [Then] Valid Then        
        VerifyValidThen();
    end;

Where the result will be (when removing Given):

    [Test]
    procedure TestFunction1()
    // [FEATURE] Feature 1
    begin
        // [SCENARIO 0001] Test function 1
        // [When] Valid When        
        ValidWhen();
        // [Then] Valid Then        
        VerifyValidThen();
    end;

And with it the helper method CreateValidGiven will be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions