2022-04-26 - Jmeter学习笔记
2022-04-26 本文已影响0人
耑意儿
本笔记为学习《6小时自动化jmeter工具》时碰到的问题笔记
传送门:作为一个初级测试,想学接口测试,但是一点头绪都没有。求教大神指点,有没有好的书或者工具推荐? - 知乎 (zhihu.com)
一、安装JDK、JRE
安装并配置环境变量
C:\Users\Administrator>java -version
java version "1.8.0_321"
Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)
cmd看到上面的结果说明安装配置成功
二:Python安装并配置
问题一:在cmd中输入python后直接跳转到应用商店
1、给python配置环境变量并将其上移到第一排
配置完了以后发现还是会跳到应用商店
2、删除或下移微软商店的环境变量
表示path下没看到微软商店的环境变量:AppData\Local\Microsoft\WindowsApps
3、再看一眼python的默认安装目录:
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10
总觉得怪怪的,于是卸载重装,配置安装目录为E://python,还是跳商店
4、配置环境变量 ,看到了令人欣喜的结果:
C:\Users\Administrator>python
Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
问题二:
E:\python>pip install -r requirements.txt -i https://pypi.douban.com/simple
Unknown option: r
Unknown or unsupported command 'install'
E:\python>pip
Did not provide a command
发现cmd找不到pip,因为电脑中安装了loadrunner,可能有多个pip导致系统不知道该找哪一个pip。
所以解决方案就是进入到python安装目录下的Script文件夹中,然后再使用pip指令
E:\python>cd Scripts
E:\python\Scripts>pip
Usage:
pip <command> [options]
Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
此时输入pip就可以看到对应的指令说明了。再操作指令:
E:\python\Scripts>pip install -r requirements.txt -i https://pypi.douban.com/simple
�[31mCould not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'�[0m
�[33mYou are using pip version 7.1.2, however version 22.0.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.�[0m
系统又告诉我们找不到requirements.txt,所以我将命令中的requirements.txt前面加这个文件所在的完整路径~
E:\python\Scripts>pip install -r E:\python\requirements.txt -i https://pypi.douban.com/simple
Collecting certifi==2017.11.5 (from -r requirements.txt (line 1))
Downloading https://pypi.doubanio.com/packages/29/9b/25ef61e948321296f029f53c9f67cc2b54e224db509eb67ce17e0df6044a/certifi-2017.11.5-py2.py3-none-any.whl (330kB)
...
...
到此,安装插件的步骤就完成了。
四、启动python项目
将项目目录下的所有文件迁移到python/projects下,注意路径不要带中文。然后执行命令python run_server.py
:出现Starting development server
说明服务启动成功
E:\python\projects>python run_server.py
Performing system checks...
System check identified no issues (0 silenced).
April 26, 2022 - 17:10:52
Django version 1.11, using settings 'studentManagementSystem.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
那么问题来了,我不知道有哪些接口可以用,于是在Postman中出现了以下尴尬的场景:
1650965092(1).png
带着疑问继续看视频