iT邦幫忙

2026 iThome 鐵人賽

DAY 4
0

In Day3, I selected the SUT and defined the basic test scope.

Okay, so now I can finally start building the project.

For this project, I will use VS Code as the IDE and Python as the programming language.
And the testing stack, I will use pytest as the test framework and requests to communicate with the REST API.
The project will be managed with Git and stored on GitHub for version control.

Set Up the Development Environment:
Before writing any tests, I first set up an isolated Python environment for the project.
First, I checked the Python version:

python --version

Then I created and activated a virtual environment:

python -m venv .venv
# Windows
.venv\Scripts\activate

After activating the environment, I installed the first two dependencies:

python -m pip install pytest requests

pytest — the test framework used to organize and execute tests.
requests — the HTTP client used to send requests to the REST API.

Last, I saved the installed dependencies:

pip freeze > requirements.txt

The requirements.txt file records the Python dependencies used by the project, so the same environment can be recreated later.

For now, the environment is very simple.but the project is ready to grow.

Set Up Version Control
With the Python environment ready, I created a GitHub repository for the project and cloned it to my local machine.

I want to use version control from the beginning, even though the project is still very small.

At this point:

  • Python is isolated in a virtual environment.
  • pytest can discover and execute tests.
  • Project dependencies are recorded in requirements.txt.
  • The project is version-controlled with Git and stored on GitHub.

No real API tests yet.

Tomorrow, I'll start sending requests to Restful Booker and build the first API tests.


上一篇
Choose the SUT: Restful Booker
下一篇
Build the First API Tests
系列文
不只會測試:30 天用 Side Project 打造 T 型技能樹5
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言