如何为Robot Framework安装MongoDBLibrary

时间:2016-11-29 09:35:14

标签: robotframework

我想使用Robot Framework连接到Mongo数据库。

我已阅读以下链接,我们必须提取源代码并安装库。 Robot FrameWork - MongoDB-Library

我安装了库,它安装在

位置
D:\Python27\Lib\site-packages\MongoDBLibrary

当我在'MongoDBLibrary'中添加RIDE库时,它显示为红色(表示库未正确安装), 当我使用eclipse + Maven project运行相同时我得到以下错误

[ ERROR ] Error in file 'D:\Robot_WorkSpace\robotFrameWork\src\test\robotframework\acceptance\MongoQuery.txt': Importing test library 'D:\Python27\Lib\site-packages\MongoDBLibrary' failed: ImportError: No module named bson
Traceback (most recent call last):
  File "D:\Python27\Lib\site-packages\MongoDBLibrary\__init__.py", line 2, in <module>
    from mongoquery import MongoQuery
  File "D:\Python27\Lib\site-packages\MongoDBLibrary\mongoquery.py", line 2, in <module>
    from bson.objectid import ObjectId
PYTHONPATH:
  C:\Users\akurasa\.m2\repository\org\robotframework\robotframework\3.0\Lib
  C:\Users\akurasa\.m2\repository\org\robotframework\robotframework\3.0\robotframework-3.0.jar\Lib
  __classpath__
  __pyclasspath__/
CLASSPATH:
  /D:/Sarada/eclipse/configuration/org.eclipse.osgi/bundles/789/1/.cp/jars/plexus-classworlds-2.4.jar

请任何人帮助我,我做错了

1 个答案:

答案 0 :(得分:1)

确保已安装PyMongo(或bson):

pip install pymongo

pip install bson(不知道是否还需要)