Skip to content
harley84 edited this page Apr 17, 2014 · 22 revisions

IntelliJBehave is an IntelliJ IDEA plugin for JBehave.

Installation

You can either install the plugin from within IntelliJ. Alternatively, download the binary zip file from downloads, unzip the contents at <IntelliJ Home>/plugins and restart IntelliJ.

Configuration

Go to IntelliJ Settings --> IDE Settings --> File Types, select JBehave story files and ensure that *.story is a registered pattern.

Register Story Filetype

Features

Syntax Highlighting

Syntax Highlighting

We do not support

  • Multiline scenario text
  • Using Given stories

Navigation to Step Definition

You can jump to the step definition from the step usage in the story by doing either of the following

  • Press cmd+B for mac or ctrl+B for win/linux when the cursor is on the step usage text
  • Perform cmd+click for mac or ctrl+click for win/linux on the step usage text

We do not support

  • Custom parameter prefix apart from the default $ for parameterized steps

Error Highlighting

Error is highlighted if a step used in the story was not defined.

Error Highlighting

Line Comment/Uncomment

You can comment/uncomment lines in the story file by using cmd+/ for mac or ctrl+/ for win/linux.

Line Comment/Uncomment

Create New JBhehave Story

You can create a new JBehave story file by selecting a folder in the project explorer and doing one of the following

  • Press cmd+alt+S for mac or ctrl+alt+S for Win/Linux
  • Right click on the folder, select New and the JBehave Story

You don't need to provide .story extension when asked to provide the name. Also the story would be created by using the Story File Template.

Story File Template

When you create a new story file the default contents are taken from the file template defined for story files. To see/modify the story file template go to IntelliJ Settings --> IDE Settings --> File Templates

Story File Template

Supported Languages

We support step definitions written in Java or Groovy.

Advanced Features

Code Inspections

In any decent-sized project, with hundreds and thousands of step definitions, it is practically impossible to find unused steps. Text search is too cumbersome. Also, for parameterized steps, text search hardly works. With IntelliJBehave, you can use code inspections to find unused steps.

Although, undefined step usages are highlighted as an error in the story files, you can see a report of all the undefined steps in the whole project though code inspection as well.

If you go to IntelliJ Settings --> Project Settings --> Inspections, you will find that IntelliJBehave has added two new inspections "Unused step declaration" and "Undefined step" under a new category "JBehave" and has enabled them by default. Here, apart from other things, you can change the severity level of the probable issues that these inspections will find.

Code Inspection Settings

When you perform code inspections from menu option Analyze --> Inspect Code... or by one the other several possible ways, the results are displayed showing steps that are not being used in any of the story files in your project.

Code Inspection Results

If you just want to run JBehave inspections, you can go to menu option Analyze --> Run Inspection by Name... and search for "JBehave".

Running *.story Files

Description coming up soon.

Feature Wish-list

  • Auto-complete steps
  • Find usages from step definition
  • Rename refactoring
  • Safe delete
  • Quick fix on errors
  • Code folding for scenarios
  • Live templates for steps

Supported IntelliJ IDEA Versions

IntelliJBehave was tested for 10.5.x and above but might work on lower versions.

Change Log

1.4

  • Fixed memory leak in scenarios related to example tables.
  • Recompiled on 1.6 to support Mac.

1.3

  • Support for multiline steps
  • Icon for story files
  • Memory and speed optimizations
  • Fix for some steps not being recognized

1.2

  • Support for IntelliJ IDEA 11.x
  • Code inspection to report undefined steps
  • Support for table parameters
  • Various bug fixes

1.1

Find unused steps through code inspection

1.0

Error Highlighting in story if step was not defined

Feedback

Please provide your comments and rating at IntelliJBehave's official IntelliJ Plugin page.

If you find any bugs or would like to suggest a new feature, please create a new issue with adequate description and a code patch if possible.

Contribute

Feel free to fork the code. If you would like to contribute directly to the trunk, send me your patch.

License

Copyright 2011 Aman Kumar

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.