Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lvanvugt opened this issue Feb 19, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@lvanvugt
Copy link
Contributor

lvanvugt commented Feb 19, 2023

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.

@lvanvugt lvanvugt added the enhancement New feature or request label Feb 19, 2023
@lvanvugt lvanvugt changed the title Use Case: removing Given/Then with a related helper method which name is not a one-to-one match with Given/Then descriptin Use Case: removing Given/Then with a related helper method which name is not a one-to-one match with Given/Then description Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant