Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

No error when multiple step implementations exist #55

Closed
hakito opened this issue Mar 7, 2016 · 5 comments
Closed

No error when multiple step implementations exist #55

hakito opened this issue Mar 7, 2016 · 5 comments
Assignees

Comments

@hakito
Copy link
Contributor

hakito commented Mar 7, 2016

When I have two step implementations with the same stepText:

public class StepImplementation
{
    [Step("Duplicate step")]
    public void DuplicateStep1()
    {
        Console.Out.WriteLine("Duplicate Step 1");
    }

    [Step("Duplicate step")]
    public void DuplicateStep2()
    {
        Console.Out.WriteLine("Duplicate Step 2");
    }
}

... the runner gives no error about ambiguous step definiton. In my case it simply executed DuplicateStep2.

In our case we had 2 step implementations with the same stepText in different assemblies.

Expected behavior:

  • Warning on scanning for step implementations
  • Error when trying to execute an ambiguous step
@sriv
Copy link
Member

sriv commented Mar 7, 2016

Gauge should also have this behaviour consistent across languages.

@hakito
Copy link
Contributor Author

hakito commented Mar 7, 2016

Are you sure? I didn't study the whole architecture of gauge and runner communication. But as far as I understood: Gauge simply loads the runner, and calls the steps from the specs file, and has no information about the actual stepNames.

But maybe I am wrong.

@sriv
Copy link
Member

sriv commented Mar 7, 2016

Gauge does most of the orchestration, but the core isn't aware of implementation (which is language specific). What I meant here is - this problem exists in other language runners as well, we need to address it there as well.

The implementation for this would be at language runner level.(In this case, the change would be in gauge-csharp).

Then there is also the aspect of IDE plugins being aware of these rules, but we should address command line first IMO.

@sriv
Copy link
Member

sriv commented Mar 21, 2016

This could be treated similar to Unimplemented Steps. The flow would then look like:

  • Gauge sends a StepValidationRequest
  • Gauge C# would send back a validation failed response with a new ErrorType = "Ambiguous Step Implementations found"

This will ensure that gauge --validate would capture duplicate steps. Also, the workflow of execution will be consistent to Unimplemented Steps case i.e the Scenarios with Duplicate/Unimplemented steps will be skipped with warnings.

Thoughts?

sswaroopgupta pushed a commit to getgauge/gauge-tests that referenced this issue Apr 11, 2016
mahendrakariya added a commit to getgauge/gauge that referenced this issue Jun 27, 2016
Update gauge-proto to include duplicate step implementation error. If
any language runner sends duplicate step implementation error, Gauge
core will recognize it and report it accordingly.

Ref getgauge/gauge-java#43
Ref getgauge/gauge-csharp#55
Ref getgauge/gauge-ruby#20
@kashishm
Copy link
Collaborator

Fix will be available in nightly >= 2016-06-30

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants