Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Pymongo in soatest

Options
sohailali034
sohailali034 Posts: 3
edited June 2017 in SOAtest

how to add the pymongo in soa test. and from where can i download the pymongo jar file for jython?

Comments

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    SOAtest ships with Jython 2.5, so you need pymongo 2.9 as described here: https://docs.mongodb.com/ecosystem/drivers/python/

    You can download pymongo 2.9 from here: https://pypi.python.org/pypi/pymongo/2.9

    I am using Windows, so I downloaded pymongo-2.9-py2.5-win32.egg

    Once you download the egg file, unzip it into a directory. Then in SOAtest, go to the Scripting preferences and specify the directory where you unzipped pymongo as the "Jython path".

    Then in an Extension Tool, you can import pymongo and use it:

    from pymongo import *
    
    def connectToMongo(x, context):
        client = MongoClient()
    

    As written this script will fail unless you have a Mongo DB instance listening on the default host and port. However, in the Extension Tool you can tell that the pymongo library is being loaded by clicking the Evaluate button - if the "Error message" box next to it is empty, then pymongo is correctly being loaded.

  • sohailali034
    sohailali034 Posts: 3
    Options

    I have downloaded pymongo 2.9 from the same link and followed the above steps , Still it shows below error
    " ImportError: No module named pymongo, "
    Do i need to install anything other than this? if not , any other alternative methods for this?

  • jakubiak
    jakubiak Posts: 798 admin
    Options

    Did you unzip the pymongo egg file? Which directory did you put into the Jython Path preference setting in SOAtest? It sounds like a configuration issue since I was able to make it work yesterday. So please give some details about exactly what you did and where you put things and hopefully we can figure it out.