SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.25k stars 754 forks source link

Opening a test from the test explorer jumps to the "Background" section instead of the scenario #482

Open icnocop opened 9 years ago

icnocop commented 9 years ago

If the feature has a "Background" section defined, opening a test from the test explorer jumps to the "Background" section instead of the scenario.

If the feature doesn't have a "Background" section defined, then it works as expected.

Visual Studio 2013 Update 4 SpecFlow 2015.1.2

samholder commented 9 years ago

Does this happen with the v2 branch? If you install the beta version from the CI nuget feed do you see the same issue? I fixed some of the line mappings in v2. I'll find the CI feed URL and post it here shortly. On 19 Sep 2015 01:10, "Rami" notifications@github.com wrote:

If the feature has a "Background" section defined, opening a test from the test explorer jumps to the "Background" section instead of the scenario.

If the feature doesn't have a "Background" section defined, then it works as expected.

Visual Studio 2013 Update 4 SpecFlow 2015.1.2

— Reply to this email directly or view it on GitHub https://github.com/techtalk/SpecFlow/issues/482.

samholder commented 9 years ago

The v2 nuget URL is https://ci.appveyor.com/nuget/specflow-ci and you need to make sure you allow beta versions in vs

icnocop commented 9 years ago

I uninstalled the SpecFlow 1.9.0 nuget package, installed the SpecFlow.2.0.0-ci99 nuget package from https://ci.appveyor.com/nuget/specflow-ci, cleaned and rebuilt the project, but still experienced the same issue.

I'm still using SpecFlow.MsTest.1.0.0 from the official nuget feed, but I'm not sure if that makes a difference.

Thank you.

lucjanl commented 8 years ago

I use

and I'm experiencing the same issue. It's hard to work fluently with this bug.

My example:

Given my scenario is

Feature: Reservation window - creating new reservation
    Blah blah blah
    Blah blah blah

Background: 
    Given the user creates new reservation
        And the reservation has number "5678/2016"

Scenario: Window fields of new reservation
    When the reservation window is open
    Then the "Number" field will show "# 5678/2016"
        And the "Name" field will be empty
        And the user will be able to change the "Name" field
        And the "Status" field will show "New"

When the test fails

Then the test results in Test Explorer shows

Test Name:  Comptelier.Logic.Tests.Presenters.ReservationPresenter.ReservationWindow_CreatingNewReservationFeature.WindowFieldsOfNewReservation
Test FullName:  Comptelier.Logic.Tests.Presenters.ReservationPresenter.ReservationWindow_CreatingNewReservationFeature.WindowFieldsOfNewReservation
Test Source:    E:\Projekty\Lucjanl\Current\Comptelier\Comptelier\Comptelier.Logic.Tests\Presenters\ReservationPresenter\Reservation window - creating new reservation.feature : line 7
Test Outcome:   Failed
Test Duration:  0:00:01,804

Result StackTrace:  
(...)
Result Message: 
Assert.Equal() Failure
Expected: New
Actual:   Nowa

In the scenario the line 7 (indicated above by "Test Source") is "Background:" so the failed step is not there. I don't know where should I find it because I use in this scenario many parameterized steps with the same test method. Finally I don't know where is the error.

I think this is a bug and it should be shown another line number to indicate the step that contains failed step.

SabotageAndi commented 8 years ago

@gasparnagy There was something with the #line generation, or?

gasparnagy commented 8 years ago

@SabotageAndi i remember a related PR already... but i cant find it now (yes, it was related to the line pragmas). Someone was mentioning that he prototyped the fix with search and replace...

gasparnagy commented 8 years ago

There was an extra unnecessary line pragma in the code....

gasparnagy commented 8 years ago

Found it: #604 (issue #361)... needs some work still.

I have a description there (https://github.com/techtalk/SpecFlow/pull/604#issuecomment-218088897) if someone wants to grab.

kappa10j commented 7 years ago

Will this fix be released? I'm seeing it too.

lukefan6 commented 7 years ago

Also experiencing this with specflow 1.9.0 If this get fixed, I suppose it will be 2.0+ right?

gasparnagy commented 7 years ago

@lukefan6 yes, based on the date it should be included in v2.2

wildroo commented 6 years ago

This's happening to me after yesterday's update from 15.0 to 15.5 VS PRO...