一、下载python安装包上传到liunx
取消上传
二、创建安装目录
mkdir /usr/local/python3
三、在解压根目录中,执行命令进行编译
tar -zxvf Python-3.6.5.tgz
cd /python-3.6.5
./configure --prefix=/usr/local/python3
四、进入解压根目录安装
1、make
2、make install
3、完毕
五、创建软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python
六、配置python环境变量:
编辑文件 :vim /etc/profile
追加:
export PYTHON3_HOME=/usr/local/python3.10.0
export PATH=$PYTHON3_HOME/bin:$PATH
source /etc/profile 加载或者重新登录
七、配置pip的环境变量
vim/etc/profile
export PIP_HOME=/usr/local/python3.10.0
export PATH=$PIP_HOME/bin:$PATH
创建软连接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
完成,pip3可以使用了。
八、依赖库安装命令
pip install robotframework==3.0 --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install pymysql --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install requests --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install robotframework-httplibrary --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install jsonpatch --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install -U robotframework-requests --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install robotframework_selenium2library --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install rsa --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install robotframework-databaselibrary --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install python-dateutil --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install pycryptodome --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install JPype1 --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install livetest --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install pythonwxgtk2.8 --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install robotframework-ride==1.7.3 --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install Pillow==8.1.2 --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
pip install wxPython-4.1.1-cp36-cp36m-linux_x86_64.whl --trusted-host cmc-cd-mirror.rnd.huawei.com -i http://cmc-cd-mirror.rnd.huawei.com/pypi/simple
九、linux下robotframework执行测试用例的几种方法
1、执行指定的测试用例文件(Test Suite)
[root@localhost cases]# python -m robot /usr/local/AutoTest/TestSuites
2、执行指定Test Suite中的指定测试用例
[root@localhost cases]# python -m robot /usr/local/AutoTest/TestSuites/PaymentCenter-Test210618.robot
十、集成Jenkins,远程执行机
1、安装插件
Publish Over SSH
Robot Framework plugin
2、配置
进入Manage Jenkins-Configure System-Publish over SSH
取消上传
任务构建配置
取消上传
Post-build Actions
取消上传
十一、远程执行机同步代码
方法一:在执行机安装git,手工登录执行机更新代码 (本文档采用这个)
方法二:在执行机安装git,Jenkins通过命令通知git更新代码
方法三:构建包,然后通过Jenkins出包,上传到执行机再解压更新代码
十二、linux搭建git
1.安装
两个文件随便放入到linux环境中哪个目录中,
添加执行权限并执行安装脚本:
chmod +x git_zlib_install.sh
./git_zlib_install.sh
----------------------
验证:git –version
取消上传
2.linux下配置git
2.1基本配置
此时,git已经安装在了linux环境中,还不能使用,需要进行下面的配置
git config --global user.name “ouzhiguang WX771223”
git config --global user.email “ouzhiguang@huawei.com”
2.2 生成公钥和私钥
ssh-keygen -t rsa -C " ouzhiguang@huawei.com"
弹出提示信息,一路回车,什么都不需要填写
一般公钥 私钥的生成目录为:/.ssh 可以安装提示信息找到文件所在位置
取消上传
2.3 将公钥添加到内源
打开公钥
cat id_rsa.pub
将里面的内容全部复制
打开isource网址,》Account settings》SSH Public Key Manage》Add Public Key
将刚才复制的内容添加到Public Key中,Name不需要填写,是自动填写的。单击save。
此时,配置完成。
取消上传
2.4获取仓库代码
git clone ssh://git@codehub-dg-y.huawei.com:2222/oWX771223/AutoTest.git
十三、问题总结
1、提示找不到Resource文件
如下图所示
WIN
取消上传
Liunx
需要把引用的Resource资源文件放到TestSuite目录下,${CURDIR}代表用例集路径
修改引用Resource${CURDIR}/publicWords.robot
修改引用Resource${CURDIR}/PaymentCenterWords.robot
或者在win遍写用例时修改兼容liunx模式路径
取消上传
2、robotframework-httplibrary不兼容修改
1.修改\livetest-0.5\livetest\__init__.py
修改:import httplib -》 import http.client as httplib
修改:import urlparse -》import urllib.parse
修改:from Cookie import BaseCookie, CookieError -》 import http.cookiejar
修改:CookieError, e 为CookieError as e
2.修改 \livetest-0.5\setup.py
修改:long_description=file('README.rst').read() -》 long_description=open('README.rst').read()
修改:version=livetest.__version__ -》 version='0.5'
修改:author_email=livetest.__author__ -》 author_email='storborg@mit.edu'
3.直接在当前窗口安装shift点击右键,选择在此处打开命令窗口,执行
python setup.py install
取消上传
4、安装好livetest后,需要去修改httplibrary的__init__.py文件(文件路径:python安装目录\Lib\site-packages\HttpLibrary)
修改:from urlparse import urlparse -》 from urllib.parse import urlparse
修改:except ValueError, e -> except ValueError as e (共两处)
5、robot没有执行结果显示或者抛错
在安装jenkins的机器目录下,自行创建三个文件,log.html\out.html\report.html
取消上传