8000 Add Windows-specific information. · ciguler/testing-python-apps@a494bb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit a494bb2

Browse files
committed
Add Windows-specific information.
1 parent 9acc053 commit a494bb2

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

section10/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Section 10: Acceptance testing
2+
3+
- On Windows can still use the PyCharm Multirun plugin, or now PyCharm CE comes with a "Compound" run configuration which you can use to run two other run configurations sequentially.

section8/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# System Testing with Postman and Newman
2+
3+
In this section, we learn about how to use Postman to write system tests, and how to run them in the command line with Newman.
4+
5+
Here's an overview of how the PyCharm Run Configuration flow goes:
6+
7+
![PyCharm Run Configuration Flow](./assets/pycharm-run-configuration-flow-export-22-03-2024-11_38_55.png)
8+
9+
## Windows-specific information
10+
11+
### Bash Support no longer needed
12+
13+
In the videos we use the **Bash Support** extension of PyCharm to interact with the command line. Specifically, we use it to create **Run Configurations** so that we can hit the "Play" button and that runs a command-line script.
14+
15+
This is no longer necessary, as PyCharm now ships with **Shell Script**. You can skip installing **Bash Support**, and where we use **Bash Support** in the videos, you can use **Shell Script**.
16+
17+
> **Key Takeaway**: don't use **Bash Support**, instead use the built-in **Shell Script**.
18+
19+
### Installing nvm (Node Version Manager)
20+
21+
![Overview of running tests with Newman](./assets/overview-of-running-tests-with-newman-export-22-03-2024-11_38_55.png)
22+
23+
In the videos we install Node Version Manager (nvm) to install a specific version of NodeJS. We use that to install Newman, which we can use to run Postman tests in the command line.
24+
25+
If you are using Windows, you'll want to install [nvm-windows](https://github.com/coreybutler/nvm-windows) instead. There's a Windows installer you can use: [github.com/coreybutler/nvm-windows/releases](https://github.com/coreybutler/nvm-windows/releases) . Download the `nvm-setup.exe` file and execute it. Once it has finished installing, you'll be able to run `nvm` in your `cmd.exe` application.
26+
27+
There, you can see the available NodeJS versions by running:
28+
29+
```bash
30+
nvm list available
31+
```
32+
33+
Then you can install the latest LTS (Long-Term Support) version:
34+
35+
```bash
36+
nvm install lts
37+
```
38+
39+
Once installed, you can use:
40+
41+
```bash
42+
nvm use lts
43+
```
44+
45+
Then, install newman:
46+
47+
```bash
48+
npm install newman
49+
```
50+
51+
Finally, you'll need to know where the `newman` executable has been placed. You can find out its location with this command:
52+
53+
```bash
54+
where newman
55+
```
56+
57+
Copy the path to the `newman` executable, as you'll need it in PyCharm when you create a **Shell Script** Run Configuration. Use the path in the **Script text** field of the Run Configuration.
58+
59+
### Running newman from PyCharm
60+
61+
1. Enable the Shell Script Plugin by going into your Settings -> Plugins -> Shell Script.
62+
2. Create a new Run Configuration by going to the top right dropdown, clicking it, and then clicking on "Edit Configurations..."
63+
3. Create a new Run Configuration of type Shell Script and give it a name, such as "Run Newman tests"
64+
4. Select "Script Text"
65+
5. In the Script text field, type your path to newman followed by `run stores-rest-api.postman_collection.json` .
66+
1. **Important** if your path to newman contains spaces, then write it in this format: `& 'path to your newman'`
67+
2. The final value of the Script text field will be something like this: `& 'path to your newman' run stores-rest-api.postman_collection.json` .
68+
6. Press OK
69+
70+
You can follow the videos as normal for using the Multirun Run Configuration to start the app and run the tests.

0 commit comments

Comments
 (0)
0