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

Feature request: enable table aliases to be used in SpecFlow.Assist CompareToInstance and CompareToSet methods #1384

Closed
6 of 25 tasks
basdijkstra opened this issue Jan 10, 2019 · 3 comments · Fixed by #2581
Closed
6 of 25 tasks

Comments

@basdijkstra
Copy link

SpecFlow Version:

  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number: 3.11.0

Visual Studio Version

  • VS 2017
  • VS 2015
  • VS 2013

Are the latest Visual Studio updates installed?

  • Yes
  • No

.NET Framework:

  • >= .NET 4.5
  • before .NET 4.5
  • .NET Core 2.0
  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0

Test Execution Method:

  • Visual Studio Test Explorer
  • TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • Command line – PLEASE SPECIFY THE FULL COMMAND LINE

<SpecFlow> Section in app.config

<specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
  <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><unitTestProvider name="NUnit" /></specFlow>

Repro Project

https://github.com/basdijkstra/specflowassist-examples

Feature Description

In #969, the ability to use TableAliases has been added for SpecFlow.Assist methods CreateInstance and CreateSet. However, these aliases are not yet available for the 'return path', i.e., CompareToInstance and CompareToSet. This prevents a user from using the same alias for a property in both directions, which could potentially lead to confusion.

Example (also featured in the repro project):
I have an object Album with an integer property LengthInMinutes:

[TableAliases("AlbumLength")]
public int LengthInMinutes { get; set; }

I want to be able to use both LengthInMinutes as well as the alias AlbumLength in my feature files. I can use the alias AlbumLength perfectly fine when creating an instance of an object from a table using

myAlbum = table.CreateInstance<Album>();

but when I want to compare this instance to a table specified in a feature file using

table.CompareInstance(myAlbum);

the alias AlbumLength is not recognized and I have to use LengthInMinutes instead, causing inconsistency in my feature specification.

@Sambafrosch
Copy link

Hi Andreas,
Are there any plans when this feature will be implemented? Today I got stuck on this issue, too.

@SabotageAndi
Copy link
Contributor

@Sambafrosch This is not on our backlog at the moment and in the near future.
But as SpecFlow is Open Source, you can add this feature and send a PR to us. We will review it and if everything is ok, probably 24 hours later a new version with the change is on NuGet.org.
If you need help with changing SpecFlow, you can join our Gitter- Channel (https://gitter.im/gasparnagy/specflow-dev?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
We also have some documentation about developing SpecFlow: https://github.com/techtalk/SpecFlow/blob/master/docs/Development.md

delta-emil pushed a commit to delta-emil/SpecFlow that referenced this issue Apr 8, 2022
delta-emil pushed a commit to delta-emil/SpecFlow that referenced this issue Apr 11, 2022
SabotageAndi pushed a commit that referenced this issue Apr 12, 2022
Co-authored-by: Emil Tzvetkov <e.tzvetkov@fio.de>
gasparnagy added a commit that referenced this issue Apr 13, 2022
* origin/master:
  expand property aliases support (#1384) (#2581)
  Document how to run tests
  Autofac global container (#2579)
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants