Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 26, 2025

Final Refactoring Updates

Renamed Java Implementation

  • Renamed MessageEndpointProcess to JavaMessageEndpointProcess to prevent name clash with the generic base class
  • Updated all references in CucumberFeatureLocalApplicationLaunchConfigurationDelegate

Moved Common Code to Base Class

  • Moved deserializeEnvelope() implementation to the base class since both Java and Python use identical Jackson-based deserialization
  • Both backends now only need to override getLabel() and provide backend-specific argument injection
  • Added dependency on io.cucumber.eclipse.java.plugins to editor bundle for Jackson access

Backend-Specific Code

  • Java: Implements addArguments() to inject -p plugin argument
  • Python: Already uses BehaveProcessLauncher.withRemoteConnection() for argument injection

Code Reduction

  • Java: ~25 lines (down from ~33)
  • Python: ~25 lines (down from ~33)
  • Base: ~240 lines including shared deserialization logic

The refactoring demonstrates maximum code reuse while maintaining clean separation of backend-specific concerns.

Original prompt

This section details on the original issue you should resolve

<issue_title>[bheave] Add support to watch the remote code execution of cucumber/behave tests</issue_title>
<issue_description>In java we have a cumber-java-plugin that opens a socket connection to the host running the process to watch the test execution and getting results.

We need to investigate if behave (source here https://github.com/behave/behave ) support something similar in general we want the following:

  1. Users should usually not need to modify their code in any way but we may inject additional commandline arguments
  2. Our code should be a python script that plugs into a suitable extension point in behave, (e.g. using the report facility)
  3. it must then somehow read a port as a parameter, this can be an ENV variable or whatever else might be possible (e.g. in java we can pass it directly as a plugin parameter)
  4. Then it should open a socket connection and send encoded cucumber messages we can read again by java code for this we should use https://github.com/cucumber/messages/tree/main/python
  5. For the protocol we want to use something similar to what https://github.com/cucumber/cucumber-eclipse/blob/main/io.cucumber.eclipse.java.plugins/src/io/cucumber/eclipse/java/plugins/MessageEndpoint.java does (so we can possibly even reuse that on the receiver side)
  6. This messages should then be read and redirected to the unittest view as we do for the java backend
  7. The copilote instructions need to be updated to reflect this new thing wen implementing new backends</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Oct 26, 2025
Copilot AI and others added 4 commits October 26, 2025 14:43
…t execution

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for watching remote execution of behave tests Add remote test execution support for Python/Behave backend Oct 26, 2025
Copilot AI requested a review from laeubi October 26, 2025 14:56
Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot some adjustments are needed see comments below.

*
* @author copilot
*/
public class BehaveMessageEndpointProcess implements IProcess, EnvelopeProvider, ISuspendResume, IDisconnect {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this code is generic enough that it can be shared between java+behave, we should move it to the generic eclipse.editor plugin instead.

to make it even more generic instead we should:

  • instead of Activator.getDefault().getLog() we should use ILog.error(...)
  • have a getter method that returns the choosen port so it can generically be accessed
  • the implementation sepecific "add arguments" methods can then be moved to a backend specific part

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the generic message endpoint code to io.cucumber.eclipse.editor.launching.MessageEndpointProcess. The Python bundle now extends this class with just ~33 lines of backend-specific code. Changes:

  • Changed Activator.getDefault().getLog() to ILog.get()
  • Added getPort() getter method
  • Backend-specific addArguments moved to BehaveProcessLauncher.withRemoteConnection()

Commit: 7254fc6

… for port

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 26, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://download.eclipse.org:80/releases/2025-09/content.jar
    • Triggering command: REDACTED, pid is -1 (http block)
  • http://download.eclipse.org:80/releases/2025-09/p2.index
    • Triggering command: REDACTED, pid is -1 (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from laeubi October 26, 2025 15:36
@laeubi
Copy link
Contributor

laeubi commented Oct 26, 2025

u

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

* `http://download.eclipse.org:80/releases/2025-09/content.jar`
  
  * Triggering command: `REDACTED, pid is -1` (http block)

* `http://download.eclipse.org:80/releases/2025-09/p2.index`
  
  * Triggering command: `REDACTED, pid is -1` (http block)

If you need me to access, download, or install something from one of these locations, you can either:

* Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled

* Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/cucumber/cucumber-eclipse/settings/copilot/coding_agent) (admins only)

@copilot I noticed in this message you try to access http urls instead of https what might be the reason for firwall blocking, is this because some data in the repository reference http and we should update that or can you update the copilote instructions that we want access download.eclipse.org (and other urls) as https always?

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 26, 2025

u

...

The HTTP URL was in the target definition file at io.cucumber.eclipse.targetdefinition/cucumber.eclipse.targetdefinition.target line 6. Changed it from http://download.eclipse.org/releases/2025-09 to https://download.eclipse.org/releases/2025-09. This should resolve the firewall blocking issue.

Commit: 15e6240

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI changed the title Add remote test execution support for Python/Behave backend Add remote test execution support for Python/Behave backend with generic message endpoint Oct 26, 2025
Copilot AI requested a review from laeubi October 26, 2025 15:55
Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot just two small suggestions, see below.

private Map<String, String> attributes = new HashMap<>();
private volatile boolean suspended;
private IBreakpoint[] breakpoints;
public class MessageEndpointProcess extends io.cucumber.eclipse.editor.launching.MessageEndpointProcess {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename it to

Suggested change
public class MessageEndpointProcess extends io.cucumber.eclipse.editor.launching.MessageEndpointProcess {
public class JavaMessageEndpointProcess extends io.cucumber.eclipse.editor.launching.MessageEndpointProcess {

to prevent the name clash?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the class to JavaMessageEndpointProcess to prevent name clash with the base class. Updated all references in CucumberFeatureLocalApplicationLaunchConfigurationDelegate.

Commit: 730d7d1

Comment on lines 32 to 35
@Override
protected Envelope deserializeEnvelope(byte[] buffer, int length) throws IOException {
return Jackson.OBJECT_MAPPER.readerFor(Envelope.class).readValue(buffer, 0, length);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both java + behave seem using the same code here, we should move it to the base class as it is likely always they case and implementations can still override it if really needed to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the common deserializeEnvelope() implementation to the base class in io.cucumber.eclipse.editor.launching.MessageEndpointProcess. Both Java and Python now use this shared implementation. Added dependency on io.cucumber.eclipse.java.plugins to the editor bundle for Jackson access.

Commit: 730d7d1

…ialization to base class

Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Copilot AI requested a review from laeubi October 26, 2025 16:03
@laeubi laeubi marked this pull request as ready for review October 26, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[beheave] Add support to watch the remote code execution of cucumber/behave tests

1 participant