Forum Discussion

kumars12's avatar
kumars12
Occasional Contributor
8 years ago
Solved

Mongo Context varibale - Is it possible to use it throughout the test suite

Greetings, While working with MondoDB using gmongo (groovy wrapper), we open connection using mongoDB context, something like this: def mongoClient = new MongoClient( new ServerAddress(dbServer), A...
  • Radford's avatar
    8 years ago

    You can set context variables in Project or TestSuite setup scripts which will then be accessible by anything under it. While I have not used this for database connections, I have stored other variables this way.

     

    A word of warning! If for example a test case relies on something defined in a project setup script, you will always have to run from the project level. I ran into problems of not just being able to run a single test case. Now I always try to make my test cases self contained.