Manish
Manish

Reputation: 191

Formatting Cucumber Feature file

I extensively use Data tables in cucumber feature file. Data Tables are mostly dump of Database table which i export in pipe delimted format and not properly aligned.

Is there any option in Cucumber-JVM that will auto align DataTables ?

Upvotes: 4

Views: 30431

Answers (9)

Madhura Da
Madhura Da

Reputation: 1

If you are using intellij use keyboard shortcut ctrl+alt+l

Upvotes: 0

Bibhu Ptr
Bibhu Ptr

Reputation: 27

In IntelliJ Reformat a code fragment In the editor, select a code fragment you want to reformat.

If you don't select a code fragment, IntelliJ IDEA will reformat the whole file.

Before reformatting, you can take a look at the code style settings that are applied to the selected code: press AltEnter and click Adjust code style settings.

In the main menu, go to Code | Reformat Code or press CtrlAlt 0L .

Upvotes: 0

Mohit
Mohit

Reputation: 125

For Eclipse IDE you could shortcut Ctrl + Shift + F for 'Pretty format' in Feature files.

Upvotes: 0

Gaurav
Gaurav

Reputation: 1370

If you're using IntelliJ go to Code>Reformat code

Upvotes: 6

Richard Day
Richard Day

Reputation: 141

cucumber --autoformat . -t @myuglytests


cucumber -help

   -a, --autoformat DIR             Reformats (pretty prints) feature files and write them to DIRECTORY.
                                    Be careful if you choose to overwrite the originals.
                                    Implies --dry-run --format pretty.

Upvotes: 1

Sergio
Sergio

Reputation: 11

Ctrl + Alt + L

It works for me!! :)

Upvotes: -1

diogo
diogo

Reputation: 3976

If you're using IntelliJ, there is also a good plugin called Pipe Table Formatter!

:)

Upvotes: 2

Matthias
Matthias

Reputation: 150

As Joe says, the --autoformat feature isn't available any more.

I found that cucumber --dry-run --format pretty --quiet --no-color pretty much gives you what you want, although you'd have to do some string-wrangling to write back to the files.

Upvotes: 2

ItsMe-Rodders
ItsMe-Rodders

Reputation: 291

I created this with a similar problem in mind. Paste your code into the editor, hit Ctrl+Enter and your table pipes will be aligned. Tidy Gherkin Chrome App

Upvotes: 1

Related Questions