Imho there is no way in java (via reflection -> annotation, method) to retrieve line numbers. The only ways I know are: * java debugger API * create and parse a stacktrace
Michael On Fri, January 23, 2009 14:21, aslak hellesoy wrote: > On Fri, Jan 23, 2009 at 2:16 PM, aslak hellesoy > <[email protected]>wrote: > > >> >> >> On Fri, Jan 23, 2009 at 1:02 PM, Mauro Talevi >> <[email protected]>wrote: >> >> >>> aslak hellesoy wrote: >>> >>>> Hi gang, >>>> >>>> >>>> With a little JRuby love I managed to hook Cucumber >>>> (http://cukes.info/) >>>> up to JBehave. My latest commit: >>>> >>>> http://github.com/aslakhellesoy/cucumber/commit/855e033832e19b5ad24 >>>> 8c57cfb4abc8f72fa2da0 >>>> >>>> >>>> What this means is that it will be possible to use Cucumber with >>>> Java, >>>> implementing steps simply by subclassing >>>> org.jbehave.scenario.steps.Steps. I don't use the Scenario or >>>> runner classes. The README in the link above explains why this is >>>> interesting. >>>> >>>> I'm planning to package Cucumber in an executable cucumber.jar file >>>> so people can run it from the command line, just like the pure ruby >>>> version. >>>> >>>> Any thoughts on this? >>>> >>>> >>>> Aslak (::) >>>> >>>> >>> >>> Ehi Asklak, >>> >>> >>> welcome back to Java-land :-) >>> >>> Very interesting stuff - I'll have a closer look and sniff at >>> weekend. But looks promising ... >>> >> >> Glad you like it. Here is how to try it out until I package a more >> user-friendly release: >> >> Install jruby and git or msysgit >> >> >> git clone git://github.com/aslakhellesoy/cucumber.git # A little slow - >> I >> need to http://kerneltrap.org/mailarchive/git/2007/10/7/331471 jruby -S >> gem install diff-lcs treetop rspec term-ansicolor cd cucumber git >> checkout -b ast git pull origin ast cd examples/jbehave mvn compile >> jar:jar >> jruby ../../bin/cucumber features jruby ../../bin/cucumber >> features/trading.feature:5:22 # Only run first and >> last scenario >> >> If you're on Windows you won't get coloured output (No ANSI Color >> support in terminal from Java AFAIK), but if you have OS X or Linux, try >> my magenta colour scheme: >> http://wiki.github.com/aslakhellesoy/cucumber/console-colours >> Also, look at the neat error output if you make any of the steps fail. >> Use >> -b to get full backtrace. --help for more. >> >> >> I'm planning to do some changes so that JBehave steps can also take >> Cucumber table objects as input. >> I'm also looking into nailgun to reduce startup overhead (JRuby's Ruby >> parser is slow although execution is fast) >> > > BTW, Cucumber's output is like this: > > > Scenario: Status alert can be activated # > features/trading.feature:5 > Given a stock of prices 0.5,1.0 and a threshold of 10.0 # > cukes.jbehave.examples.trader.scenarios.TraderSteps > > Do you know if there is a way to get access to the line of each step > (annotation or method definition) so I can append it to the class name? > I'm super rusty on Java :-) > > > Aslak > > > >> >> Aslak >> >> >> >>> More later! >>> >>> >>> Cheers >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >>> >> >> >> -- >> Aslak (::) >> >> > > > > -- > Aslak (::) > > -- --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
