Skip to content

Fail fast when target server is not running #896

@Pradhvan

Description

@Pradhvan

Feature request

Description the feature

When scanapi is run against a server that is not reachable (e.g. the API under test was never started, or the host/port is wrong), the run currently completes with 0 errors and produces a report. Instead, scanapi should detect this condition up front and exit with a clear error such as "server not running / unreachable at " and a non-zero exit code.

Is your feature request related to a problem?

Yes. Running the smoke suite without first starting the target API still yields a "successful" report with 0 errors, which is misleading. This silently hides broken CI pipelines and local setups — engineers believe their tests passed when in reality no request ever got a real response.

Do you have any suggestions on how to add this feature in scanapi ?

  • Before executing the first request, perform a lightweight connectivity check against the configured base_url (e.g. TCP connect or a HEAD / request) and fail with a descriptive message if it is unreachable.
  • Alternatively, classify connection-level errors (ConnectionError, ConnectTimeout, DNS failures) as hard failures rather than per-request soft errors, and abort the run early if the first N requests all fail this way.
  • Make sure the exit code is non-zero so CI jobs actually fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions