Automated testing from environment construction to use case integration (python_unittest)

                      selenium from environment construction to use case integration (python_unittest)

System: windows 10, no different from windows7

Language: python3.7

Environment: pycharm+firefox+selenium

Function: From environment construction to use case integration

1. Set up the environment selenium+python37

https://www.cnblogs.com/feeland/p/4425488.html

Browser plug-in: https://www.cnblogs.com/nancyzhu/p/8589764.html

2. Tool pycharm (the best compiler for python currently)

To install, it is recommended to download the free version (community or campus version). The function can be learned and used, and does not need to be activated.

PyCharm installation and configuration_AmberWen's blog-CSDN blog

Activated (inactive).

'''

https://blog.csdn.net/wangdongwei0/article/details/83105031

'''

Chinese

https://blog.csdn.net/jia666666/article/details/81777017

3.Use of selenium ide

The selenium ide plug-in installed in the new version of Firefox no longer supports copying or saving code. There are ways to configure it online: How to install SeleniumIDE that matches the old version of Firefox - Baidu Experience

The old version is not easy to use at all and crashes easily. give up. There is a software called " Katalon Automation Recorde " that works with the new version of firefox and is as powerful as selenium. Support exporting python2 code. It's enough for getting started. It only takes a few days for the automatic recording function to work. python is really simple.

Installation method and usage method: Katalon---a useful selenium automated testing plug-in_Yangming Apprentice's Blog-CSDN Blog

4. Convert python2 code to python3

#基本用法
python 2to3.py -w python2.py
#例子:使用D:\Python37\Tools\scripts下的2to3.py将桌面上的一个python2.py的文件转换为3格式的。此语句会直接将文件转换成python3
#cmd运行:   
python D:\Python37\Tools\scripts\2to3.py -w C:\Users\moubiao\Desktop\python2.py

5. Automated testing unittest

Unittest basic format and explanation

https://www.cnblogs.com/feng0815/p/8045850.html

Selenium automated testing-unittest unit testing framework use_LupuX's blog-CSDN blog

6. The exported log and report (code) can be used directly

https://www.cnblogs.com/caoj/p/7815797.html

        a.How to add third-party libraries in python:

How pycharm automatically imports third-party libraries or modules - Baidu Experience

        b. Error python3: (unicode error) 'utf-8' codec can't decode (about the logger.py file): python3: (unicode error) 'utf-8' codec can't decode_Stupid Blog -CSDN Blog

7.run_all_case file (optimized) can be used directly

https://www.cnblogs.com/lunvo/p/9184151.html

Guess you like

Origin blog.csdn.net/i_likechard/article/details/87938349