Abstract
The purpose of this project was to improve developer efficiency and code quality. Behavioral API tests were implemented in the ASWWU Web server for user authentication and the Elections, Jobs, and Mask projects, and development workflow was standardized. Tests were designed to allow project growth as the department adopts new technologies.
Introduction
Prior to this project, tests were performed manually by running a local development server and making requests through Postman, cURL, or the frontend interface. While sufficient for small changes, it became difficult to make system-wide changes with confidence that nothing was broken across projects.
Behavioral tests ensure that the server operates as expected from a user’s perspective, regardless of internal implementation. They also serve as documentation for new developers by demonstrating expected server behavior — especially valuable for maintaining continuity as student developers graduate each year.
Test Structure
Tests interact with the server through the API only, without preloading data directly into the database, to avoid dependence on frameworks that might be replaced. A behavioral test simulates a set of actions a user is expected to take. Subtests were added for common repeated actions, working as parameterized tests. Between each test, the database and temporary files are cleaned, and the server thread is stopped and restarted.
Data and Analysis
Roughly 2500 lines of new code were written; after refactoring and cleanup, the overall project grew by ~2200 lines with ~700 lines of unused code removed. 47 tests were written bringing coverage to 58%. Before this project there was no continuous integration in use.
Summary
This project implemented much-needed API testing for ASWWU Web and covers the department’s most significant projects. With the testing framework in place, the Web team can safely make necessary upgrades such as the transition to Python 3 and the addition of new features.