citrusframework / citrusframework/citrus

How to ensure endpoint singleton in test suite

Open
#848 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

**Citrus Version**
3.1.2

**Question**
Using the JavaConfig, how to have a real singleton bean for an endpoint which is bound to a http port and use it across multiple tests.
After the 1st test in the suite, the subsequent tests fail with such errors:
Caused by: com.consol.citrus.exceptions.CitrusRuntimeException: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080

The report shows:
MyTest>TestNGCitrusSupport.before:124 » BeanCreation Error creating bean ...

**What I've tried so far**
@Scope("singleton") for configuration class as well as for bean get method for the endpoint.

**Additional information**
I see my class CitrusEndpointConfig being instantiated for every test in the run.

Contributor guide

Open the contributing guide

Research direction

Start by examining CitrusEndpointConfig and the TestNGCitrusSupport.before path mentioned in the report, then reproduce the endpoint binding failure across multiple tests on port 8080. Done means the endpoint configuration is reused across the test suite and subsequent tests no longer fail with the port-binding error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.