iiitl / iiitl/chat-app

Rewrite python test script to use asyncio

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
medium refactor
Dominant language
Go
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## Problem
The current test script (`tests/main.py`) relies on multithreading to simulate concurrent clients. While this approach works for moderate workloads, it introduces significant overhead due to thread creation, context switching, and synchronization (e.g., `join()` calls).

As the number of simulated clients increases, this overhead grows rapidly, leading to degraded performance and potential system instability. This makes the current approach unsuitable for scaling the test harness further.

## Objective
Refactor the existing test script to use an asynchronous model based on `asyncio`.

## Rationale
An asynchronous approach is better suited for I/O-bound workloads such as HTTP requests and WebSocket communication. By leveraging `asyncio`, the test script can:
- Reduce the overhead associated with thread management
- Improve resource efficiency
- Provide a more scalable foundation for simulating concurrent clients
- Align better with modern Python concurrency patterns

This change is intended to make the test framework more maintainable and future-proof, even if current system or language limitations prevent extremely large-scale simulations.

## Scope
- Replace multithreaded client simulation with an `asyncio`-based implementation
- Maintain existing test logic and behavior (client registration, message sending, message receiving, and validation)
- Ensure the refactored script remains easy to understand and extend

## Expected Outcome
A cleaner, more efficient test script that uses asynchronous concurrency, reducing unnecessary overhead and enabling better scalability for future testing needs.

Contributor guide

Open the contributing guide

Research direction

Start with tests/main.py and trace the current multithreaded client simulation, including registration, message sending, receiving, and validation. Run the existing test script before and after the refactor to compare behavior. Done means the same test logic works with asyncio-based concurrency and the script remains understandable and extensible.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.