A book of Python automation, recently written by the Master worm teacher. The introduction to the BDD structure lettuce chapter.
Because it is a small white, step-by-step operation, do not talk about how to perform the operation, first of all encountered several pits, and how to solve:
The first pit: Python2 and Python3 installed on the same host, how to distinguish between running, without interference?
How does the python command execute in cmd? Pip installs a third-party library?
Workaround:
A. Locate the installation location,copy Python.exe in the current directory, and then rename the copy to Python2; the same method will Python3 do the same;
B. Go to the respective script directory and take Pip.exe as a previous step
Installing lettuce
This part if according to the book said only install lettuce, and then execute lettuce command error
This is the second pit, what should we do?
Workaround:
In the bug Teacher's blog to find the reason, found that less installed 2 third-party libraries, fill up
>PIP2 Install Lettuce_webdriver
>pip2 Install nose
After successful installation, execution, or the second error above.
Careful review of the error feedback is found in the python37 inside, but Python27/script also placed in the environment variables ah, how can not find it?
Try to follow the first pit solution and rename the Lettuce.exe copy to Lettuce2.exe
Execute also reported error again:
Check the error, found that the lettuce2_script.py cannot be opened, there is a lettuce_script.py in the directory. Well, I'll try to copy it again. Rename it to lettuce2_script.py try it.
It worked!!
began to write a case, finished writing in the implementation of the time also found as above this error. Clearly in the directory there are feature also execute files Ah, how is the error?
How is this hole broken?
Executed several times and found no relevant answers on the Internet.
Rely on their own poor English comprehension ability, is the program too rigid, must find features this directory?
So
I'll give him a feature directory and put the feature file inside.
Perform:
Unbelievebale!!!
It's still smarty pants, yeah!.
These are the initial encounters of the pit, I hope to help everyone, thank you!
Please, collect!
The lettuce of the BDD framework of Python automation