How to get going with the BDD blog post

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

How to get going with the BDD blog post

Post by boegvald » Mon Aug 23, 2021 1:00 pm

I am trying to get going with BDD testing using the Ranorex blog post https://www.ranorex.com/blog/how-to-use ... d-process/

First issue was with a "tools version" in the downloaded SpecFlow (https://github.com/ranorex/bdd-specflow) project: "The tools version 12.0 is unrecognized. Available tools versions are 2.0, 3.0, 4.0."
- By looking into other posts in this forum, I solved that one by changing the tools version in the project file to 4.0

Now, I need to target it to .Net 3.5 (according to the blog post). But I am seemingly not allowed to change the .Net version in any of my Ranorex Solutions anymore (running on 10.1, .Net 4.8), even though I have several other .Net versions installed. Also, in the latest push to GitHub, it seems like the code has been made .Net 4.6.2 compliant (comment to latest push: "Pushed to .NET 4.6.2 and removed "copy local" from Ranorex assemblies").

I have .Net 4.6.2, but is no longer allowed to chose it in Ranorex Stuido project options (see attached screen dump).

Anyone know how to "downgrade" .Net for a project in 10.1?

All help is highly appreciated!
Attachments
dotnet versions in ranorex.png
dotnet versions in ranorex.png (36.41 KiB) Viewed 1152 times
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Mon Aug 23, 2021 1:57 pm

I went a little ahead despite the .Net issue:

Now trying to acieve this one (from the blog post): "Add the NuGet package for NUnit.Runners.2.7.1, it is important that you use version 2.7.1". How do I achieve that one? When searching for NUnit.Runners in the package manager I get:
NUnit.Runners.png
NUnit.Runners.png (60.96 KiB) Viewed 1144 times
Is it the NUnit.Runners.Net4 (I guess not, as that one is not on v2.7.1 yet)?

Then SpecFlow.NUnit.Runners? I do get an error: Child dependencies of dependency only packages cannot mix external and project packages". And how do I ensure version 2.7.1?

Appreciate any help I get get to make this work!
Best Regards

Bo

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7422
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to get going with the BDD blog post

Post by odklizec » Mon Aug 23, 2021 2:34 pm

Hi,

I've just consulted the blog post with Ranorex folks and according to them, it should be OK using the newest .Net and Nunit package. Aside of the old version numbers, the article should be still valid ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Mon Aug 23, 2021 3:55 pm

Great. Thanks much.

Now, to the next issue (I manage to figure out the NUnit.Runners issue):

When building, I do get the following build error:
C:\Users\bobo\OneDrive - Lessor A S\Desktop\bdd-specflow-master\IdeIntegration\RanorexIntegration\TechTalk.SpecFlow.RanorexIntegration.csproj(303,5) : Error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\..\packages\MSBuildTasks.1.5.0.235\build\MSBuildTasks.targets.
But when checking the package folder, the mentioned file is there. I have tried to restore and to remove/add the package. Same issue.

Do the wizard has a solution to that one as well?
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Tue Aug 24, 2021 11:15 am

Finally I found out...:

- Set tools version to 4.0 in all project-files in the downloaded repository
- Build each project (in the right order) in order to generate the DLLs being referred to in the RanorexIntegration project.
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Tue Aug 24, 2021 1:40 pm

Now starting to create a BDD-enabled project in Ranorex according to the blog post:
Install-Package SpecFlow.NUnit

Install-Package NUnit.Runners
I guess both shall be installed with latest version instead of the version mentioned in the blog post (like for the previous builds). But both install result in the error 'The attribute "CopyToOutputDirectory" in element <none> is unrecognized':
CopyToOutputDirectory.png
CopyToOutputDirectory.png (167.64 KiB) Viewed 1108 times
Any idea about how to get around this?
Best Regards

Bo

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7422
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to get going with the BDD blog post

Post by odklizec » Tue Aug 24, 2021 1:46 pm

Hi,

There are some problems in the BDD integration guide. Please follow these Jacob's comments and eventually fix the integration:

Code: Select all

Under the "Make your Ranorex Solution BDD ready" there is a code block with some NuGet code snippets.  The first line is correct, but the second needs to be updated.  Currently the snippet shows:
Install-Package SpecFlow.NUnit -Version 2.3.2
Install-Package NUnit.Runners.2.7.1

And this should be changed to:
Install-Package SpecFlow.NUnit -Version 2.3.2
Install-Package NUnit.Runners -Version 2.7.1

The next issue I've found is in the same section.  The second C# segment says to add <probing privatePath="Runtime"/>in the assemblyBinding section.  In the text (between the code snippets), the first double quote is backwards, so anyone that copies and pastes is going to run into an error.  It also omits the need to add the assemblyBindingsection (which isn't there by default).  The full code segment that needs to be inserted into app.config should be:
<assemblyBinding>
<probing privatePath="Runtime"/>
</assemblyBinding>
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Wed Aug 25, 2021 11:09 am

Thanks much, Pavel.... again!

I managed to install the packages and create a Ranorex Solution for trying out a Feature file. I can build the solution in Studio. But when trying to run it using the command line in the blog post I get the following error:
C:\Users\bobo\BDD\bddTrial\BDD2\BDD2\bin\Debug>..\..\..\.\packages\NUnit.Runners.2.7.1\tools\nunit-console-x86.exe BDD2.dll
NUnit-Console version 2.7.1.0
Copyright (C) 2002-2014, 2018 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
OS Version: Microsoft Windows NT 6.2.9200.0
CLR Version: 2.0.50727.9151 ( Net 3.5 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-3.5
Could not load file or assembly 'Ranorex.Core, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b798506b574ebc9a' or one of its dependencies. The system cannot find the file specified.
I wonder if I am back again to .Net versioning problems? When building the SpecFlow DLLs in Ranorex Studio, the only available choice is .Net 4.8. Same .Net is used for the test solution. Also, I could not select version of the NUnit.Runners package in the package manager, so that one is the latest one. The .Net 3.5 is enabled on my Windows machine (but do not appear in the add/Remove programs). Also, I am wondering why it mention Windows NT when I am on Windows 10 (but that could be due to the old .NEt 3.5?).

Any suggestions?

I think I will go back to creating the SpecFlow stuff and try to add the NUnit.Runners in version 2.7.1 using the command line I learned when setting up the test solution. But honestly, I have no idea if that is related to the error.
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Wed Aug 25, 2021 11:11 am

...and just an additional thought: Do I need to change the tools version in the project files to 3.4 instead of 4.0 (from the 12.0 in the downloaded files)...
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Wed Aug 25, 2021 12:30 pm

I made progress... Setting local copy for the Ranorex.Core package...thanks to this post: could-not-load-file-or-assembly-ranorex ... 13906.html

(Also, I changed to tools version 3.5 and changed to the 2.7.1 version of NUnit.Runners in the SpecFlow project)

Now to the next problem when running the test
C:\Users\bobo\BDD\bddTrial\BDD2\BDD2\bin\Debug>..\..\..\.\packages\NUnit.Runners.2.7.1\tools\nunit-console-x86.exe BDD2.dll
NUnit-Console version 2.7.1.0
Copyright (C) 2002-2014, 2018 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
OS Version: Microsoft Windows NT 6.2.9200.0
CLR Version: 2.0.50727.9151 ( Net 3.5 )

ProcessModel: Default DomainUsage: Single
Execution Runtime: net-3.5
Unhandled Exception:
NUnit.Core.UnsupportedFrameworkException: Skipped loading assembly BDD2 because it references an unsupported version of the nunit.framework, 3.0.5797.27534

Server stack trace:
at NUnit.Core.Builders.TestAssemblyBuilder.GetCandidateFixtureTypes(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites, Boolean checkCompatibility)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites, Boolean checkCompatibility)
at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
I guess they key is "...unsupported version of the nunit.framework, 3.0.5797.27534". That is indeed the version of the NUnit.Framework package being referenced in the project after adding the two packages mentioned in the blog post:
NUnitFramework.png
NUnitFramework.png (14.85 KiB) Viewed 1067 times
What a journey..... any idea about how to fix this one?
Best Regards

Bo

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Thu Aug 26, 2021 10:37 am

I give up on this.... Tried to start all over..... Cannot even build the Ideintegration project in the first project...
Error loading code-completion information for Mono.Cecil, Version=0.9.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL from Mono.Cecil, Version=0.9.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL:
Could not find assembly file.
The files are there, both for .Net 3.5 and 4.0. Ranorex seems to enforce .Net 4.0 in the CSPROJ files, but the reference in the project is for 3.5... what a mess...

I'll call the support to see if they want to make this work.... otherwise will look for another platform for BDD.
Best Regards

Bo

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7422
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to get going with the BDD blog post

Post by odklizec » Thu Aug 26, 2021 10:39 am

Hi,

I think your best hope here is to contact directly support about this. A very few people is actually using BDD with Ranorex. It's simply not worth the effort ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

boegvald
Posts: 62
Joined: Wed Mar 13, 2019 9:02 am

Re: How to get going with the BDD blog post

Post by boegvald » Wed Sep 01, 2021 8:49 am

Well, I don't know if we will be successful with our BDD implementation. Time will show. But the business people have started doing Gerkin to specify stories, and I do need to implement some setup to "catch" and use that information, Ranorex or not. Given those circumstances, I definitively would prefer to use Ranorex, both because we know it already, but also to utilize the recording modules and repositories we already have.

Moving to a "native" BDD implementation with coded tests, no repository, no recording modules, does not look very attractive to me. So, even though we loose some of the benefits of Ranorex when doing BDD, I think Ranorex still has a lot to give compared to native implementations. Also, I don't think BDD is relevant for all types of stories/tests, so introducing another framework would result in us to maintain two parallel frameworks, which I really would like to avoid.

But obviously, if there is no working BDD solution for Ranorex, I will have to implement an alternative framework (let me know if you know a good one :-)).
Best Regards

Bo