即使已實現基本步驟定義,也不會綁定Specflow步驟


2

enter image description here

您好,即使已實現了基本的步驟定義,也未綁定該步驟(因此,顏色為紫色)。

在屏幕截圖中,我單擊了"確定"。V / Studio將我帶到下一個屏幕快照中的屏幕。

enter image description here

我嘗試了一些事情:

  1. 評論了可能具有相似步驟的任何其他情況

  2. 單擊"全部保存"按鈕以保存所有更改。

  3. 我還重建了解決方案。屏幕快照中顯示的錯誤已修復。因此,該項目中沒有未解決的錯誤。

我們將非常感謝您的幫助。謝謝。

0

You have two methods with the same Then expression in your StudentStepDefinition.cs file:

    [Then(@"A New Student Record Amoo Should Be Created")]

Each expression needs its own unique expression to be able to bind and run it.

So you need to remove one.


0

Visual Studio caches the step bindings, and sometimes this cache becomes out of sync with your code. The fix is a bit obtuse, but simple. Close all Visual Studio windows and delete files in your temp directory matching stepmap

  1. Close all Visual Studio windows
  2. Open File Explorer
  3. Click on the location bar showing the current directory. It should turn into an editable text field and highlight the folder path
  4. Type %TEMP% and press Enter to navigate to your temp directory
  5. Type stepmap in the search file text box towards the upper right corner of File Explorer
  6. Delete all files that show up in the file search

Or open a Windows command prompt and type:

del %TEMP%\*stepmap*