SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

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

Open icnocop opened this issue 9 years ago • 12 comments

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

icnocop avatar Sep 19 '15 00:09 icnocop

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" [email protected] 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 avatar Sep 19 '15 06:09 samholder

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

samholder avatar Sep 19 '15 07:09 samholder

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.

icnocop avatar Sep 20 '15 19:09 icnocop

I use

  • Visual Studio 2015 Update 2
  • SpecFlow 2.0.0
  • SpecFlow.xUnit 2.0.0
  • xUnit and othe xUnit libraries 2.1.0

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.

lucjanl avatar Apr 07 '16 14:04 lucjanl

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

SabotageAndi avatar Jun 30 '16 16:06 SabotageAndi

@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 avatar Jul 15 '16 10:07 gasparnagy

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

gasparnagy avatar Jul 15 '16 10:07 gasparnagy

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.

gasparnagy avatar Jul 15 '16 10:07 gasparnagy

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

kappa10j avatar Mar 08 '17 17:03 kappa10j

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

lukefan6 avatar Aug 04 '17 02:08 lukefan6

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

gasparnagy avatar Aug 04 '17 09:08 gasparnagy

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

wildroo avatar Dec 19 '17 23:12 wildroo