Skip to content

Commit c67d284

Browse files
authored
Update README.md with instructions
1 parent 16d216e commit c67d284

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
11
# pytest-scenarios
22
The repository uses pytest as the test writing library for different scenarios using vscode as the IDE
3+
4+
Set up pytest in VS code
5+
6+
Getting started :
7+
8+
# Prerequisites
9+
Before we set up Pytest in VS Code, you need to install the below prerequisites in your operating system,
10+
* VS Code
11+
* Python
12+
13+
# Setting Up Pytest In VS Code
14+
To set up Pytest in VS Code, follow the steps described below,
15+
Pip3 install pytest
16+
Pip3 show pytest to check the version
17+
18+
# Step 1 - Install Python Extension in VS Code
19+
Open your VS Code and search for Python on the extensions. You’ll find the Python extension at the top of the search result. Select and click install.
20+
This allows to work with python interact within VSCode and utilize Github copilot as an agent.
21+
22+
# Configure pytest
23+
Now the Python extension installation will automatically install Pytest on your environment. All you need to do is just configure Pytest. Follow the below steps to configure Pytest.
24+
Click the flask icon on the left tool bar. You can find this once you open a repository that contains Python unit tests.
25+
Now click on “Configure Python Tests”, select pytest and the test code library
26+
27+
After configuring Pytest, VS Code will automatically discover your Unit Tests. You can customise which folder to look for tests in the settings under "python.testing.cwd" parameter in the .vscode/settings.json file.
28+
# install requests
29+
* To download and install requests, run this command from the terminal : pip install requests
30+
31+
# Set up virtual environment
32+
Pytest works best in virtual environments when using in VSCode. A virtual environment  is a built-in way to create an environment. A virtual environment creates a folder that contains a copy (or symlink) to a specific interpreter. When you install packages into a virtual environment it will end up in this new folder, and thus isolated from other packages used by other workspaces.
33+
Working in virtual environments-
34+
Pyenv is a library to work with different python environments-
35+
brew install pyenv
36+
pyenv install 3.13
37+
38+
# Add libraries to be used in the package to requirements.txt :
39+
Set up requirements.txt for required packages
40+
pydantic- For contract tests
41+
requests - To get data from APIs
42+
pytest-
43+
jsonschema
44+
pytest-html
45+
pytest-cov
46+
pre-commit
47+
48+
*  pip install -r requirements.txt
49+
50+
# Report view in VScode in TEST RESULTS :
51+
52+

0 commit comments

Comments
 (0)