Cucumber Feature Editor with refactoring support

1,033 views
Skip to first unread message

jenkins

unread,
May 14, 2011, 1:36:25 AM5/14/11
to Cukes
I use the following:

Windows XP Professional -
Java - JDK
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

jruby
jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (Java HotSpot(TM)
Client VM 1.6.0_24) [Windows XP-x86-java]

The following gems are installed through jgem install cucumber
json-1.4.6-java
gherkin-2.3.5-java
term-ansicolor-1.0.5
builder-2.1.2
diff-lcs-1.1.2
cucumber-0.10.2

ant
Apache Ant(TM) version 1.8.2 compiled on December 20 2010

I am using cuke4duke {& Eclipse as the IDE} for writing step
definitions.

For writing features I am using simple editors like Wordpad.
Refactoring to be done on the feature files is a huge challenge & the
associated single time changes needed in the step definition.{I have a
collection of around 60 feature files and around 15 classes with step
definitions}

Could you please suggest a good cucumber feature editor {preferably
open source} with good refactoring capabilities and syntax
highlighting.

aslak hellesoy

unread,
May 16, 2011, 4:10:11 AM5/16/11
to cu...@googlegroups.com
I doubt any of them has refactoring support.

Can you give a concrete example of a refactoring you want to do?

Aslak
 
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


Robert

unread,
May 16, 2011, 12:28:31 PM5/16/11
to cu...@googlegroups.com
Thanks, Aslak.  I've been looking for several editing tools to compare against.  I've also had a look at Relish (http://relishapp.com/). Although it does not support editing at this point, it has an impressive set of features for managing your scenarios.

Matt Wynne

unread,
May 16, 2011, 12:46:50 PM5/16/11
to cu...@googlegroups.com
Hi Robert,

On 16 May 2011, at 17:28, Robert wrote:

> I've also had a look at Relish (http://relishapp.com/). Although it does not support editing at this point, it has an impressive set of features for managing your scenarios.

Thanks :)

Relish is certainly focussed on providing a tool for the *non-technical* team member at this point - the person who wants to read and perhaps even own the features, but doesn't want to learn git / svn or how to use a text editor. After all, Cucumber is supposed to help us bridge the gap with these people.

That doesn't rule out adding some ability to suggest changes to or edit the features at some point, but we'll wait until that appears on our backlog[1]. Otherwise if someone else builds an online editor for cukes, we could integrate with that.

[1] http://relish.uservoice.com

cheers,
Matt

--
Freelance programmer & coach
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne

aslak hellesoy

unread,
May 16, 2011, 12:50:34 PM5/16/11
to cu...@googlegroups.com
On Mon, May 16, 2011 at 5:46 PM, Matt Wynne <ma...@mattwynne.net> wrote:
Hi Robert,

On 16 May 2011, at 17:28, Robert wrote:

> I've also had a look at Relish (http://relishapp.com/). Although it does not support editing at this point, it has an impressive set of features for managing your scenarios.

Thanks :)

Relish is certainly focussed on providing a tool for the *non-technical* team member at this point - the person who wants to read and perhaps even own the features, but doesn't want to learn git / svn or how to use a text editor. After all, Cucumber is supposed to help us bridge the gap with these people.

That doesn't rule out adding some ability to suggest changes to or edit the features at some point, but we'll wait until that appears on our backlog[1]. Otherwise if someone else builds an online editor for cukes, we could integrate with that.


A modest start of a web-based gherkin editor is here: https://github.com/cucumber/gherkin-editor
Refactoring of sources files would definitely be within the scope of this project.

If anyone (jenkins?) can provide concrete examples of what kind of refactorings are desired we can create tickets for it...

Aslak

[1] http://relish.uservoice.com

cheers,
Matt

--
Freelance programmer & coach
Founder, http://relishapp.com
+44(0)7974430184 | http://twitter.com/mattwynne

jenkins

unread,
May 16, 2011, 1:29:10 PM5/16/11
to Cukes
To describe the refactroing support required, consider this.

Following are my two java files:

//File: User.java
import cuke4duke.annotation.I18n.EN.And;
public class User {
@And ("launch the url \"((?:[^\"]|(?<=\\\\)\")*)\"")
public void launch(String url) {
}

@And ("login as \"((?:[^\"]|(?<=\\\\)\")*)\" and \"((?:[^\"]|(?<=\\\\)
\")*)\"")
public void login(String email, String password) {
}

@And ("Verify that the Login is Successful")
public void verifyLoginSuccessful() {
}

@And ("Verify that the Login is UnSuccessful")
public void verifyLoginIsUnSuccesful() {
}

@And ("logout from the application")
public void logout() {
}

@And ("Close the browser\\.")
public void close() {
}
}


//File: Cart.java
import cuke4duke.annotation.I18n.EN.And;
public class Cart {
@And ("From the category \"((?:[^\"]|(?<=\\\\)\")*)\" add the item
\"((?:[^\"]|(?<=\\\\)\")*)\" of quantity \"((?:[^\"]|(?<=\\\\)\")*)
\"")
public void addItem(String category, String item, String quantity) {
}

@And ("Update the item \"((?:[^\"]|(?<=\\\\)\")*)\" with the new
quantity \"((?:[^\"]|(?<=\\\\)\")*)\"")
public void updateItem(String item, String newQuantity) {
}

@And ("Remove the item \"((?:[^\"]|(?<=\\\\)\")*)\" from the shopping
cart")
public void removeItem(String item) {
}

@And ("Verify the item \"((?:[^\"]|(?<=\\\\)\")*)\" exists in the Cart
\\.")
public void verifyItemExists(String item) {
}

@And ("Verify the item \"((?:[^\"]|(?<=\\\\)\")*)\" is absent in the
Cart\\.")
public void verifyItemIsAbsent(String item) {
}
}



And following are my two of the feature files:

#File: Login.feature
@login
Feature: Login
@negative
Scenario: Invalid Login
And launch the url "http://..."
And login as "inv...@invalid.com" and "invalid"
And Verify that the Login is UnSuccessful
And Close the browser.
@smoke
Scenario: Valid Login
And launch the url "http://..."
And login as "us...@user.com" and "user"
And Verify that the Login is Successful
And logout from the application
And Close the browser.


#File: CartTransactions.feature
@cart
Feature: CartTransactions
@smoke
Scenario: Add and Update
And launch the url "http://..."
And login as "us...@user.com" and "user"
And From the category "Components->Monitors" add the item "Samsung
SyncMaster 941BW" of quantity "2"
And Update the item "Samsung SyncMaster 941BW" with the new quantity
"5"
And Verify the item "Samsung SyncMaster 941BW" exists in the Cart.
And logout from the application
And Close the browser.
@regression
Scenario: Add Update and remove
And launch the url "http://..."
And login as "us...@user.com" and "user"
And From the category "Components->Monitors" add the item "Samsung
SyncMaster 941BW" of quantity "2"
And Update the item "Samsung SyncMaster 941BW" with the new quantity
"5"
And Remove the item "Samsung SyncMaster 941BW" from the shopping
cart
And Verify the item "Samsung SyncMaster 941BW" is absent in the
Cart.
And logout from the application
And Close the browser.


The step "Close the browser.", if I want to change (re-factor) to
(say) "Exit Browser", then the changes have to be done manually at 4
different places. {2 feature files and 1 java file}. It is very
tedious to at first find which are all the feature files where the
same step is used and then make all the actual changes.

Please suggest a better and easier way of re-factoring.


On May 16, 9:50 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:
> > Founder,http://relishapp.com
> > +44(0)7974430184 |http://twitter.com/mattwynne
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Cukes" group.
> > To post to this group, send email to cu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > cukes+un...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/cukes?hl=en.- Hide quoted text -
>
> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Andy Waite

unread,
May 16, 2011, 2:07:28 PM5/16/11
to cu...@googlegroups.com
> The step "Close the browser.", if I want to change (re-factor) to
> (say) "Exit Browser", then the changes have to be done manually at 4
> different places.   {2 feature files and 1 java file}.  It is very
> tedious to at first find which are all the feature files where the
> same step is used and then make all the actual changes.
>
> Please suggest a better and easier way of re-factoring.

Just do a search-and-replace within the project?

Andy

jenkins

unread,
May 16, 2011, 9:03:32 PM5/16/11
to Cukes
Andy - My question here is more from the generic perspective. Text
and replace has its host of problems like changing text at
unintentional places {within comments / super strings etc., where the
substring matches the search string.

Also I may wish to change the order of arguments etc., hence
refactring is a better alternative to search-and-replace.
Reply all
Reply to author
Forward
0 new messages