Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用SoapUI JDBC测试步骤连接到MongoDB?_Mongodb_Jdbc_Driver_Soapui - Fatal编程技术网

如何使用SoapUI JDBC测试步骤连接到MongoDB?

如何使用SoapUI JDBC测试步骤连接到MongoDB?,mongodb,jdbc,driver,soapui,Mongodb,Jdbc,Driver,Soapui,我正在使用SoapUI测试REST/SOAP服务。此时,我需要连接到MongoDB并从db中提取一些值 我一直在初始化数据库 下面的错误代码段: com.eviware.soapui.support.SoapUIException: Failed to init connection for driver[com.mongodb.mongo], connectionString [mongodb://<userName>:<pwd>@<domain>:<

我正在使用SoapUI测试REST/SOAP服务。此时,我需要连接到MongoDB并从db中提取一些值

我一直在初始化数据库

下面的错误代码段:

com.eviware.soapui.support.SoapUIException: Failed to init connection for driver[com.mongodb.mongo], connectionString [mongodb://<userName>:<pwd>@<domain>:<port>/<collectionName>]

我首先看到的是无法通过mongoDB的驱动程序类进行连接。

一个可能的选择是在您的mongoDB上安装sleepy mongoose,因此它可以响应HTTP/REST请求。然后,您可以使用SOAPUI中的HTTP请求测试步骤直接从mongo提取任何您想要的信息


让我知道这是否有用

您可以在测试用例的“groovy测试步骤”中轻松使用下面的groovy代码,并连接到mongodb。在此之前,请确保mongodb java客户端jar文件和gmongo位于soapUI安装的{Installation Directory}\bin\ext文件夹中

格蒙戈:

Mongodb Java客户端:


你安装了JDBC驱动程序吗?您在属性中定义了它吗?你们联系得怎么样?@SiKing 1。我确实在“C:\Program Files\SmartBear\SoapUI-5.1.2\bin\ext”中安装了JDBC驱动程序“mongodb-driver-3.0.0”。2.我尝试将其添加到SoapUI中的Flie>首选项中,但在那里找不到任何选项。3.我正在尝试通过SoapUI测试用例中提供的JDBC测试步骤连接mongoDB。我只需要驱动程序名就可以连接到mongodb。谢谢@Dimitri,尽管我只能访问安装在第三方的db中的一个集合。我没有在本地安装mongoDB。我提供的域名,以达到数据库和获取结果。遇到的问题是无法创建与mongoDB的连接,我无法调用mongoDB的驱动程序类:(
    Sun Jun 07 14:39:24 IST 2015:ERROR:An error occurred [No suitable driver], see error log for details

Sun Jun 07 14:39:24 IST 2015:ERROR:java.sql.SQLException: No suitable driver
   java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(Unknown Source)
    at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:51)
    at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequestTestStepDesktopPanel$TestConnectionAction.actionPerformed(JdbcRequestTestStepDesktopPanel.java:616)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
import com.gmongo.GMongoClient
import com.gmongo.GMongo
import com.mongodb.MongoCredential
import com.mongodb.ServerAddress

//def credentials = MongoCredential.createMongoCRCredential('admin', 'students', 'admin' as char[])

//def client = new GMongoClient(new ServerAddress("127.0.0.1:27017"))

context.gmongo=new GMongo()
def db=context.gmongo.getDB("test")
log.info db.fruit.find().count()

db.fruit.find().each{

    doc->log.info doc

    }