richardlawrence / cuke4nuke Goto Github PK
View Code? Open in Web Editor NEWSupport for writing Cucumber step definitions in .NET.
Home Page: http://wiki.github.com/richardlawrence/Cuke4Nuke
Support for writing Cucumber step definitions in .NET.
Home Page: http://wiki.github.com/richardlawrence/Cuke4Nuke
Try this undefined step:
Given I have "(.*)" cukes in my belly
When Cuke4Nuke prints snippets I get the following error:
Feature: Snippet bug Scenario: the bug # features\utf8_bug.feature:3 Given I have "(.*)" cukes in my belly # features\utf8_bug.feature:4 2 scenarios (2 undefined) 4 steps (2 undefined, 2 passed) 0m0.547s 353: unexpected token at '(.*)" cukes in my belly$\")]\npublic void IHaveCukesInMyBelly()\n{\n}"]' (JSON::ParserError) C:/ruby/lib/ruby/gems/1.8/gems/json_pure-1.2.0/lib/json/common.rb:123:in `parse' C:/ruby/lib/ruby/gems/1.8/gems/json_pure-1.2.0/lib/json/common.rb:123:in `parse' C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.6.1/bin/../lib/cucumber/wire_support/wire_packet.rb:8:in `parse' C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.6.1/bin/../lib/cucumber/wire_support/connection.rb:40:in `fetch_data_from_socket' C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.6.1/bin/../lib/cucumber/wire_support/connection.rb:20:in `call_remote'
I'm not 100% positive that this is a Cuke4Nuke bug. It could also be a bug in the ruby json gem, or in Cucumber's wire protocol. If that's the case, please close this issue and create an issue in Cucumber that links back to this one.
If it is a Cuke4Nuke bug and it turns out to be related to the .NET JSON library, I just came across this one: http://www.infoq.com/news/2010/01/Json-NET - it might (or might not) solve it. In any case it seems fast :-)
This step:
Feature: UTF-8 bug Scenario: the bug Given Hellesøy has some scandinavian characters
And this step definition:
[Given(@"^(.*) has some (.*) characters$")] public void IHaveSomeInternationalCharacters(string who, string what) { }
Gives me the following output:
Given Hellesøy has some_scandinavian_n characters
(I used italic to show the highlighted parameters). This is because the byte_offset for each capture group is incorrectly calculated. It reports character offset, but needs to report byte offset (some characters are 2 bytes). Cuke4Duke does this correctly - see http://github.com/aslakhellesoy/cuke4duke/blob/master/cuke4duke/src/main/java/cuke4duke/internal/language/StepArgument.java
Adding a Background section breaks Cuke4Nuke. The following Script works OK from Cucumber directly but not from Cuke4Nuke
Feature: Hello World
In order to ensure that my installation works
As a Developer
I want to run a quick Cuke4Nuke test
Background:
Given The Greeting Separator is ,
Scenario: Hello World
Given The Action is Hello
When The Subject is World
Then The Greeting is Hello, World.
Scenario Outline: Hello World (more complicated)
Given The Action is <action>
When The Subject is <subject>
Then The Greeting is <greeting>.
Examples:
|action|subject|greeting|
|Hello|Mike|Hello, Mike|
|Jump|Tom|Jump, Tom|
|Shout|Jim|Shout, Jim|
When executed with Cuke4Nuke, it prints:
d:\work\Cuke4NukeExample>Cuke4Nuke bin\Debug\Cuke4NukeExample.dll
Feature: Hello World
In order to ensure that my installation works
As a Developer
I want to run a quick Cuke4Nuke test
Background: # features/basic.feature:6
Given The Greeting Separator is , # features/basic.feature:7
Scenario: Hello World # features/basic.feature:9
Given The Action is Hello # Unknown
When The Subject is World # Unknown
Then The Greeting is Hello, World. # Unknown
Scenario Outline: Hello World (more complicated) # features/basic.feature:14
Given The Action is # Unknown
When The Subject is # Unknown
Then The Greeting is . # Unknown
Examples:
| action | subject | greeting |
| Hello | Mike | Hello, Mike |
| Jump | Tom | Jump, Tom |
| Shout | Jim | Shout, Jim |
4 scenarios (4 undefined)
16 steps (12 skipped, 4 undefined)
0m0.421s
undefined method handle_step_failed' for #<Cucumber::WireSupport::WireProtocol::Requests::SnippetText:0x31ae3cc> (NoMethodError) C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/wire_packet.rb:28:in
send'
C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/wire_packet.rb:28:in handle_with' C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/connection.rb:21:in
call_remote'
C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/request_handler.rb:10:in execute' C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/wire_protocol/requests.rb:45:in
execute'
C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/wire_protocol.rb:14:in snippet_text' C:/Ruby/lib/ruby/gems/1.8/gems/cucumber-0.5.3/bin/../lib/cucumber/wire_support/wire_language.rb:38:in
snippet_text'
I tried using Cuke4Nuke to drive tests using Watin. Watin requires that the current thread have it's ApartmentState set to STA (http://watin.sourceforge.net/apartmentstateinfo.html).
The only way I've got this to work is adding the STAThreadAttribute to the static Main method in the Servers Program class.
Is it possible to add this to Cuke4Nuke, or have it configurable for the Server?
Currently the wire_language is doing this, but it should instead ask the server side to provide snippets. This requires a change in both Cucumber and Cuke4Nuke.
It should be possible to start cuke4nuke so that when the server starts, it's being debugged by Visual Studio so you can set breakpoints in your step definitions.
See this blog post for a neat hack to work around this for now:
http://www.richardlawrence.info/2010/01/12/debugging-cuke4nuke-step-definitions/
My suggestion in the comments for that blog post is to use the /DebugExe command-line switch for of VS: http://www.olegsych.com/2007/08/debugexe-command-line-switch-in-visual-studio/
Screencasts have been a big part of the easy adoption of RSpec and Cucumber in the Ruby community. I think we need a screencast, as soon as Cuke4Nuke is ready, that people can use to (a) see how easy and fun it is to use, (b) give them something to refer to when they're first getting going themselves.
I am trying to use .NET 4 in a cuke4nuke project, so that i can integrate it with awesomium (http://awesomium.com/), and be able to do headless testing assertions, but the problem i face is that by default awesomium relies on 4.0 only, while cuke4nuke has issues with 4.0:
here is the error message i'm getting:
Description:
Stopped working
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: cuke4nuke.server.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 4cd1e6f2
Problem Signature 04: mscorlib
Problem Signature 05: 2.0.0.0
Problem Signature 06: 4e1539fa
Problem Signature 07: 1cda
Problem Signature 08: 73
Problem Signature 09: System.BadImageFormatException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1033
Scenario: GroupBy Color
Unable to contact the wire server at :3901. Is it up? (Cucumber::WireSupport::Co
nnection::ConnectionError)
Thanks,
Angel
This requires a change to the wire protocol.
There are currently too many manual steps involved in a new Cuke4Nuke release. Update gem/Rakefile to fix this.
When building a gem...
This may not be needed if Richard's new launcher launches both the server and cucumber, but here goes...
VS fails to build the assembly if Cuke4Nuke.Server is running. The server has to be stopped and restarted, which means lots of switching and very disrupted flow. Not sure how to implement this though. Just close this ticket if the other solution works better.
Is there any way to use Cuke4Nuke on Framework 4.0, the platform is a constraint in our current scenario. I keep bumping into the "Unable to contact the wire server" message.
I’m considering either adopting this project or using some of its code in another. Before I do that I’d like to know what license applies.
We should be able to recognize simple types from the regular expression character class that is being used.
First thought example:
[Given("^I push the button labeled (\d+)$")]
public static void PushButton(int value) {
calculator.Push(value);
}
Second thought example:
This example assumes that transform support has been written. In that case, we can provide built-in transforms for the built-in .NET types (int, float, double, DateTime) etc...
[Given("^I am late for an important date on (date .*)$")]
public static void LateForADateOn(DateTime date) {
}
Hello Richard,
I followed your screencast example to setup the cuke4nuke. I used ruby window installer
(“rubyinstaller-1.8.6-p383-rc1”) and the step install cuke4nuke failed for me. I am using
Windows Vista Business premium (SP2). Visual Studio 2008 .NET 3.5
Here is the actual error when I try to execute the install cuke4nuke
C:\Ruby>gem install cuke4nuke --no-ri --no-rdoc
Building native extensions. This could take a while...
ERROR: Error installing cuke4nuke:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
checking for strncpy_s()... no
creating Makefile
make
'make' is not recognized as an internal or external command,
operable program or batch file.
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.
5 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/win32-api-1.4.5/ext/gem_make.ou
t
C:\Ruby>gem list cuke
*** LOCAL GEMS ***
C:\Ruby>
C:\Ruby\bin>gem list
*** LOCAL GEMS ***
builder (2.1.2)
cucumber (0.5.3)
diff-lcs (1.1.2)
json_pure (1.2.0)
polyglot (0.2.9)
term-ansicolor (1.0.4)
treetop (1.4.3)
win32console (1.2.0)
C:\Ruby\bin>
Thanks for your help.
Add support for the use of argument transforms in the Given/When/Then regular expressions.
Not sure if we need this
Similar to NUnit, load My.dll.config files automatically.
Add methods such as RowHashes
Hi,
after installing cuk4nuke following instructions, I am getting this error when trying to run a test:
Given a logged on agent
ComponentActivator: could not instantiate Fortis.Edison.WebSite.Features.Features.step_definitions.Steps (Castle.MicroKernel.ComponentActivator.ComponentActivatorException from :3901)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, Object[] arguments, Type[] signature)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context)
at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler,Type service, IDictionary additionalArguments)
at Cuke4Nuke.Core.ObjectFactory.GetObject(Type type)
at Cuke4Nuke.Core.StepDefinition.Invoke(ObjectFactory objectFactory, String[] args)
at Cuke4Nuke.Core.Processor.Invoke(String id, String[] args)
at Cuke4Nuke.Core.Processor.Process(String request)
features\agent_can_add_customer.feature:8:in `Given a logged on agent'
What am I missing?
Thanks
protocol version
server name
So that users can do their own logic around scenario titles, tags, etc.
This is just because I'm too lazy to switch from OSX when I want to work on / play with Cuke4Nuke.
Is this even possible? I think Mono supports the version of C# we're using, but I'm not sure how we're read the .SLN files to make the build command. Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.