Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _Where sleek plugin meets seamless BDD workflow_
- 🗂️ Step definition navigation: Jump between features and step definitions like a time traveler.
- 🎨 I18n Syntax Highlighting: Make your tests shine with vibrant visual feedback.
- 🛠️ Cucumber Console Output Panel: See clear results and trace bugs in a heartbeat.
- 🔍 Structured Compare: Semantic diff view for feature files showing changes at Feature, Scenario, and Step levels.



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Feature: Structured Compare Demo
This feature demonstrates the structured compare functionality
for Cucumber feature files in Eclipse.

Background: Common setup
Given the system is initialized
And the user is logged in

Scenario: Simple login test
Given a user with username "john"
When the user logs in with password "secret"
Then the user should see the welcome page
And the session should be active

Scenario Outline: Multiple login attempts
Given a user with username "<username>"
When the user logs in with password "<password>"
Then the login should be <result>

Examples: Valid credentials
| username | password | result |
| john | secret1 | success |
| jane | secret2 | success |

Examples: Invalid credentials
| username | password | result |
| bob | wrong | failure |
| alice | invalid | failure |

Rule: Password policy enforcement

Background: Password requirements
Given password minimum length is 8 characters
And password must contain at least one number

Scenario: Valid password
When a user sets password "secure123"
Then the password should be accepted

Scenario: Invalid password - too short
When a user sets password "short"
Then the password should be rejected
And an error message should be displayed

Scenario: Data table example
Given the following users:
| username | email | role |
| john | john@email.com | admin |
| jane | jane@email.com | user |
| bob | bob@email.com | user |
When I query all users
Then I should see 3 users
And the admin user should be "john"
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Feature: Structured Compare Demo
This feature demonstrates the structured compare functionality
for Cucumber feature files in Eclipse.
Updated version with modifications for comparison.

Background: Common setup
Given the system is initialized
And the user is authenticated
And the database is clean

Scenario: Simple login test
Given a user with username "john"
When the user logs in with password "secret"
Then the user should see the dashboard
And the session should be active
And notifications should be loaded

Scenario: Quick logout test
Given a logged in user
When the user clicks logout
Then the user should be logged out

Scenario Outline: Multiple login attempts
Given a user with username "<username>"
When the user logs in with password "<password>"
Then the login should be <result>
And audit log should record the attempt

Examples: Valid credentials
| username | password | result |
| john | secret1 | success |
| jane | secret2 | success |
| admin | admin123 | success |

Examples: Invalid credentials
| username | password | result |
| bob | wrong | failure |

Rule: Password policy enforcement

Background: Password requirements
Given password minimum length is 10 characters
And password must contain at least one number
And password must contain at least one special character

Scenario: Valid password
When a user sets password "secure@123"
Then the password should be accepted
And a confirmation email should be sent

Scenario: Invalid password - too short
When a user sets password "short"
Then the password should be rejected
And an error message should be displayed
And the user should be prompted to try again

Scenario: Data table example
Given the following users:
| username | email | role |
| john | john@email.com | admin |
| jane | jane@email.com | user |
| bob | bob@email.com | user |
| alice | alice@email.com | moderator |
When I query all users
Then I should see 4 users
And the admin user should be "john"
And the moderator user should be "alice"
4 changes: 3 additions & 1 deletion io.cucumber.eclipse.editor/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
io.cucumber.tag-expressions,
org.eclipse.unittest.ui;bundle-version="1.0.0",
io.cucumber.gherkin-utils;bundle-version="9.0.0",
org.eclipse.core.expressions;bundle-version="3.9.500"
org.eclipse.core.expressions;bundle-version="3.9.500",
org.eclipse.compare;bundle-version="3.5.0"
Bundle-RequiredExecutionEnvironment: JavaSE-21
Automatic-Module-Name: io.cucumber.eclipse.editor
Bundle-ActivationPolicy: lazy
Export-Package: io.cucumber.eclipse.editor,
io.cucumber.eclipse.editor.compare,
io.cucumber.eclipse.editor.console,
io.cucumber.eclipse.editor.debug,
io.cucumber.eclipse.editor.document,
Expand Down
18 changes: 18 additions & 0 deletions io.cucumber.eclipse.editor/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,22 @@
pattern="io.cucumber.eclipse.editor/io.cucumber.console">
</activityPatternBinding>
</extension>

<!-- Structured Compare Support -->
<extension
point="org.eclipse.compare.structureCreators">
<structureCreator
class="io.cucumber.eclipse.editor.compare.GherkinStructureCreator"
extensions="feature"
id="io.cucumber.eclipse.editor.compare.structureCreator">
</structureCreator>
</extension>
<extension
point="org.eclipse.compare.contentViewers">
<viewer
class="org.eclipse.compare.contentmergeviewer.TextMergeViewer"
extensions="feature"
id="io.cucumber.eclipse.editor.compare.textViewer">
</viewer>
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package io.cucumber.eclipse.editor.compare;

import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.DocumentRangeNode;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Image;

/**
* Node representing a structural element in a Gherkin document for compare operations.
* <p>
* This class represents nodes in the compare tree view, such as Features, Scenarios, Steps, etc.
* Each node corresponds to a specific range in the document and has a type that determines
* its icon and behavior in the compare view.
* </p>
* <p>
* Extends DocumentRangeNode to properly integrate with Eclipse Compare framework for
* navigation and content display.
* </p>
*/
public class GherkinNode extends DocumentRangeNode implements ITypedElement {

// Node types
public static final String FEATURE_FILE = "feature-file";
public static final String FEATURE = "feature";
public static final String SCENARIO = "scenario";
public static final String BACKGROUND = "background";
public static final String RULE = "rule";
public static final String STEP = "step";
public static final String EXAMPLES = "examples";

private final String nodeType;

/**
* Creates a new Gherkin node
*
* @param parent parent node (null for root)
* @param typeCode type code for this node (used by Eclipse Compare)
* @param id unique identifier for this node
* @param document the document containing this node
* @param start start offset in document
* @param length length of the node's range
* @param nodeType the Gherkin element type (feature, scenario, etc.)
*/
public GherkinNode(DocumentRangeNode parent, int typeCode, String id, IDocument document,
int start, int length, String nodeType) {
super(parent, typeCode, id, document, start, length);
this.nodeType = nodeType;
}

@Override
public String getName() {
return getId();
}

@Override
public String getType() {
return nodeType;
}

@Override
public Image getImage() {
// Return null to use default icons
return null;
}

/**
* Get the node type
*/
public String getNodeType() {
return nodeType;
}
}
Loading