Using Specflow steps defined in another dll

1,094 views
Skip to first unread message

vladimir boyarkin

unread,
Apr 10, 2012, 6:33:04 AM4/10/12
to spec...@googlegroups.com
Good day, colleagues.

I faced with some trouble when using specflow.
I have some projects which should be tested and i Have some common steps for all of them (NavigationHelpers, Element interaction helpers)
I want to define them in some framework with forbidden commit compiled in a dll and included to specfiic test projects as a reference.

But, as I understood Specflow can only find step definitions in another projects  in the solution but no in dlls. It is completely inappropriate for me, because the testing framework is placed in separate repository (SVN), so I am forbidden by our system architect to mix projects from different repositories in one solution.

Is there any solution how to include step definitions from a dll not from a project?

Thanks a lot

Roman Gavrilov

unread,
Apr 10, 2012, 1:17:13 PM4/10/12
to spec...@googlegroups.com
there is a way to use configuration to point to bindings defined
outside of the project.

https://github.com/techtalk/SpecFlow/wiki/Configuration

<specFlow>
<stepAssemblies>
<!-- <stepAssembly assembly="{name-of-assembly-containing-bindgins}" /> -->
</stepAssemblies>
</specFlow>

--roman

vladimir boyarkin

unread,
Apr 10, 2012, 1:58:42 PM4/10/12
to spec...@googlegroups.com
            if (specFlowProject != null)
            {
                foreach (var assemblyName in specFlowProject.RuntimeConfiguration.AdditionalStepAssemblies)
                {
                    string simpleName = assemblyName.Split(new[] { ',' }, 2)[0];

                    var stepProject = VsxHelper.FindProjectByAssemblyName(project.DTE, simpleName);
                    if (stepProject != null)
                    {
                        function = FindCodeFunction(stepProject, bindingMethod);
                        if (function != null)
                            return function;
                    }
                }
            }

When I try to got this binding by IntelliSense, I have nothing and even I always have "steps being populated 0%" message, that means the IntelliSense failed with internal error.
Probably the solution you have provided works in test runtime, but I know this feature and l know that it is not working in test generation. But intellisense in writing ATDD tests is the key feature for us, if it is not working - specflow is useless for us despite of its fascinating possibilities.

So, I clarify, I need to make IntelliSense work with steps defined in another compiled dll, sorry for inconvinience

вторник, 10 апреля 2012 г., 21:17:13 UTC+4 пользователь Roman V. Gavrilov написал:
Reply all
Reply to author
Forward
0 new messages