Use robot to test postgresql problem on mac

Let's first introduce the environment that needs to be installed to use the robot.

-- The mac has python
1.robot

2.wxpython 2.8.12.1 installed by default. After installing the ride, you need to use

3.ride

. After that, open the ride and prompt that the python environment is 32-bit. Now the default python on mac is 64-bit. The online tutorial is to execute this code:
defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

Okay, but now the location ride can be started normally, and test cases can be written.

Testing sometimes also needs to verify database information, so we need to download a robotframework_databaselibrary. Directly pip install robotframework_databaselibrary
but because I am using a postgresql database, I also need to download psycopy and directly pip install psycopy2.

Now start to create a test example, the code is as follows

*** Settings ***
Library DatabaseLibrary
*** Test Cases ***
Connect To Database psycopg2(dbapiModuleName) (database name) (access user name) (access password) (database ip) 5432 (database service port)
@{ids} Query (database script)
Disconnect From Database #Open the database connection

but this error was reported when running:

ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
  Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
  Expected in: flat namespace
in /Library/Python/2.7/site-packages/psycopg2/_psycopg.so

The cause of this problem is caused by python, which requires 64 Bit, but we set 32-bit before, so now we need to reset python:
defaults write com.apple.versioner.python Prefer-32-Bit -bool no

but found that after setting this, ride can't be opened, it's really a Big pit.
In this case, just use the command to execute:
pybot -s '*' -d output/ Suite-database.txt
found that it is ok.
But these two things are indeed a big pit, and it seems that they can only coexist for a while. . . . .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269047&siteId=291194637