8000 Merge pull request #10 from tecladocode/jose/cou-448-find-alternative… · tsenturion/testing-python-apps@e9cbacb · GitHub
[go: up one dir, main page]

Skip to content

Commit e9cbacb

Browse files
authored
Merge pull request tecladocode#10 from tecladocode/jose/cou-448-find-alternative-to-bash-support-extension
Add Windows-specific information for s8 and s10
2 parents 9acc053 + 62638e6 commit e9cbacb

File tree

4 files changed

+77
-0
lines changed

4 files changed

+77
-0
lines changed

section10/README.md

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

section8/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
Other alternatives include [nodeenv](https://github.com/ekalinin/nodeenv), [nodist](https://github.com/marcelklehr/nodist), or [nvs](https://github.com/jasongin/nvs).
28+
29+
There, you can see the available NodeJS versions by running:
30+
31+
```bash
32+
nvm list available
33+
```
34+
35+
Then you can install the latest LTS (Long-Term Support) version:
36+
37+
```bash
38+
nvm install lts
39+
```
40+
41+
Once installed, you can use:
42+
43+
```bash
44+
nvm use lts
45+
```
46+
47+
Then, install newman:
48+
49+
```bash
50+
npm install newman
51+
```
52+
53+
Finally, you'll need to know where the `newman` executable has been placed. You can find out its location with this command:
54+
55+
```bash
56+
where newman
57+
```
58+
59+
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.
60+
61+
### Running newman from PyCharm
62+
63+
1. Enable the Shell Script Plugin by going into your Settings -> Plugins -> Shell Script.
64+
2. Create a new Run Configuration by going to the top right dropdown, clicking it, and then clicking on "Edit Configurations..."
65+
3. Create a new Run Configuration of type Shell Script and give it a name, such as "Run Newman tests"
66+
4. Select "Script Text"
67+
5. In the Script text field, type your path to newman followed by `run stores-rest-api.postman_collection.json` .
68+
1. **Important** if your path to newman contains spaces, then write it in this format: `& 'path to your newman'`
69+
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` .
70+
6. Press OK
71+
72+
You can follow the videos as normal for using the Multirun Run Configuration to start the app and run the tests.
Loading
Loading

0 commit comments

Comments
 (0)
0