SpecFlow doesn't work on local machine; get a '*.feature.cs' could not be found - specflow

I am trying to set up a hello world project SpecFlow but I cannot seem to build and run the tests for my project. I have even sent my .sln to a colleague and it builds and runs perfectly on his machine.
We are both using Visual Studio 2019; I followed the 'Getting Started' page on spec flow website; I have 'Enable SpecFlowSingleFileGenerator' set to False. I have the extension installed for Visual Studio 2019.
Example files: https://github.com/SpecFlowOSS/SpecFlow-Examples
When I go to build I get the following in the *.feature.cs file:
#error Could not find a reference to SpecFlow in project 'MyProject.Specs'.
#error Please add the 'TechTalk.SpecFlow' package to the project and use MSBuild generation instead of using SpecFlowSingleFileGenerator.
#error For more information see https://specflow.org/documentation/Generate-Tests-from-MsBuild/
Any ideas?

Related

Visual Studio 2019 Test Explorer puts all tests under "Not Run Tests"

I have a ASP.Net Core 3 project with Visual Studio Professional 19.4.1 with xUnit 2.4.0. I have a couple of tests written there. My problem is that Visual Studio shows all the tests in this project always under "Not Run Tests". The same tests run well with command line (dotnet test) or another computer.
Repairing/Reinstalling Visual Studio did not help.
Any help is much needed!
UPDATE: I also realized that extension DotNet Extensions for Test Explorer is not present on this computer. This is present on other computer where these work. The problem, however, is how and where to get this extension from?
I already have xunit.runner.visualstudio 2.4.0 included in the project.
Any help is much valuable!!!
Upgrade the nuget package Microsoft.NET.Test.Sdk to version 16.4.0 (or newer).
When creating a new xunit project in vs2019, the version of Microsoft.NET.Test.Sdk installed is 16.2.0, which xunit.runner.visualstudio (v2.4.0 or newer) doesn't seem to work in.
Okay, got the same error where it simply did not run any of my tests despite obviously knowing about them (visible in test explorer in Test > Test Explorer). When I pressed Run or Run all tests, it just categorized them all as "not run". To fix this I lowered my .Net Core Target framework from 3.1 to 3.0 and that fixed it for me after a clean, rebuild of the unit test project.
This error may occur if you have cloned from a repository that used a different framework.
Installing both xunit.runner.visualstudio and xunit.runner.console worked for me.

Unable to build WiX 3.10 project in TFS 2015

I am using TFS 2015 trail version in windows server 2012.I created windows service project in visual studio community edition along with WiX Project to package the windows service. If i build the solution from visual studio, I am able to get the MSI. But if i use Visual studio build in TFS 2015,i get the following error.
"Unexpected exit code received from msbuild.exe: 1" and "Task VSBuild
failed. This caused the job to fail. Look at the logs for the task for
more details."
I refered the below links as reference :
http://wixtoolset.org/documentation/manual/v3/msbuild/wix_with_team_build.html-
http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html
1) I am unable to follow the first link steps as i got struck in step 2:
i am unable to find configuration folder in build definition.
I was reading that we do not have TFSBuild.proj straing from TFS version 2010.
"Right-click on the Build Definition and select View Configuration
Folder." "Check out and open the file named TFSBuild.proj."
2)I am unable to follow second link as well. I am getting below error:
"The imported project "C:\wix\3.8\Wix.targets" was not found. Confirm
that the path in the declaration is correct, and that the
file exists on disk."
since I am new to TFS Build 2015, any help or guidance will be appreciated.
Beginning with NuGet 2.7, the NuGet Visual Studio extension integrates into Visual Studio's build events and restores missing packages when a build begins. This feature is enabled by default. If you are using NuGet to install Wix packages, that's why you can get a successful build from visual studio.
If you want to use NuGet to install Wix packages, you can create one build.proj to restore these packages during build. Check: http://docs.nuget.org/consume/package-restore/team-build
If you don't use NuGet to install Wix packages, a traditional way you can refer to:http://edwinfrey.com/blog/2012/06/11/building-wix-msis-in-tfs-preview/

Using GoogleTestRunner in our TFS Build

We are using the Google Test framework (version 1.7) for unit tests in C++ project (with Visual Studio 2012 and TFS 2012). By using GoogleTestRunner for VS2012 I am able to discover the tests written in Google Test within Visual Studio and run them. So far so good :)
Now I would like to run the tests with my CI build I have set up on our TFS. Therefore I have installed the GoogleTestRunner on my build server for the user that runs our build. If I run the build (and tests) on the build server directly in Visual Studio it works - but when the build is triggered by the TFS build definition I displays the following message in the log:
No test found. Make sure that installed test discoverers & executors,
platform & framework version settings are appropriate and try again.
Any suggestion what I am missing?
Is this working for anybody at all?
Your help is highly appreciated!
Christoph
I have been able to sort it out myself :)
There is a guide showing how to get it running for NUnit. Just follow that guide and adopt it to the GoogleTestRunner:
http://bartwullems.blogspot.de/2012/10/tfs-2012-build-configure-nunit-to-run.html
I extracted the DLLs from the GoogleTestRunner.vsix file with 7zip (I assume any other Zip program would work as well). I checked in all DLLs I found there (as described in the mentioned guide) - don't know if really all DLLs are needed.

Problems building a simple F# project in Xamarin Studio on Windows 8

I've had VS2013 installed on my windows 8 laptop and F# works fine.
I've since installed Xamarin Studio version 4.2.2 but unfortunately can't get any F# project to build even a very simple one.
I installed F# Version 3.0 from the Web Installer and have installed the F# addin in Xamarin Studio and restarted it. Compiling the simple Console Project just gives me the error:
Error: Build failed. See the build log for details.
With no other details anywhere.
In the fsproj file There is the following:
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets"
I'm not sure where the MSBuildExtensionPath32 is set or where it currently points to but if I update this to a hard-coded path that actually points at my file:
<Import Project="C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
Then when I build the project in xamarin it builds successfully.
Is there an easy way of setting the MSBuildExtensionsPath32 to my actual path for xamarin? I don't really want to resort to having to set up a .bat file to launch it but can't find an option in xamarin to configure it.
I feel I must be missing something.
Thanks
It looks like the F# project templates are using a path to an older version of F#. There is a discussion about this on the GitHub repository for the F# addin. Hopefully the project template can be updated to support different versions of F# being installed. For now you can modify your project file.
MSBuildExtensionsPath32 points to C:\Program Files (x86)\MSBuild
So you could try modifying the project template to use the following path, which should work on your machine:
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />

TFS 2012 + VS 2013 + Microsoft Fakes compile issue (only during TFSBuild)

We are using TFS 2012 (Update 3) and VS 2013 RC. We have a .sln file with a two projects - the main project / assembly, and a UnitTest project. The unit test project is leveraging Microsoft Fakes. Within Visual Studio (we are using Premium), I can compile the .sln and run the tests. On the build agent, I can use Visual Studio to compile and build the .sln and run the tests. But when we queue a build, it fails to build the UnitTest project because it can't find the Fakes assembly. It doesn't appear to be dynamically creating it like it does when you build in Visual Studio. Typically in VS is creates the fakes dll and puts it in the FakeAssemblies folder. After the build fails, I can log in and see it did not create a FakeAssemblies directory at all.
The error is...
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (1605): Could not resolve this reference. Could not locate the assembly "System.Web.Http.5.0.0.0.Fakes". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
Our build is using the default template - and we have selected to build the .sln (which has the main assembly and the unit test project). Should we not be including the UnitTest in that .sln? Is there some other way the UnitTest should be getting compiled during the build?
Does anyone know why the build wouldn't by creating the Fake assembly dynamically like Visual Studio does?
Thanks!!!
I had the same issue but with TFS 2012 and VS 2012 and solved it by installing Visual Studio in TFS Server. So if you've already installed VS there, this advice won't help you.
First, I tried to copy that assembly from the folder in my local machine to the same folder in the TFS server. It's located in c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll.
The problem was solved, a test project was built successfully, but each test that were using Fakes were not passed. There was an exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException:
UnitTestIsolation instrumentation failed to initialize. Please restart
Visual Studio and rerun this test.
I did not have time and decided to make the second step and installed Visual Studio in TFS machine and all problems disappeared

Resources