Connection between through MongoDB and Selenumn Web Driver

        Connection between through MongoDB and  Selenium Web Driver
        Code for search any record in mongo db collection 
        Search record in "LAMPSTACKRESPONSE" collection
             
             // To connect to mongodb server
              MongoClient mongoClient = new MongoClient("172.16.1.203" , 27017 );
                 // Now connect to your databases
                 DB db = mongoClient.getDB("ritesh");
                
                 char[] password = new char[] {'s', 'p', 'a', 't', 'e', 's','t'};
                 boolean authenticated = db.authenticate("ritesh", password);
                 if (authenticated) {
                        System.out.println("Successfully logged in to MongoDB!");
                    } else {
                        System.out.println("Invalid username/password");
                    }
                 BasicDBObject account = null;
                 DBCollection coll = db.getCollection("LAMPSTACKRESPONSE");
                 DBCursor cursor = coll.find();
                 // Get documents by query
                 BasicDBObject query = new BasicDBObject("logicName",getlogicname);
                 cursor = coll.find(query);
                 int recordCount=cursor.count();
                 System.out.println("Count of web site--> "+recordCount);
               
                 if(recordCount >= 2)
                 {
                  Assert.assertEquals("scale up done","scale up done");
           
                 }
                 else
                 {
                     Assert.assertEquals("Scale up not done","Scale up not done on another platform");
                 }
https://www.youtube.com/watch?v=TmHILJhJfFo
https://www.youtube.com/watch?v=odxU3L1OB-M


Donate:

Please Donate the some money (anything do you want) for my
blog if you beneficial for this, I will provide more real example for the
latest technique for whom who wants to make a carrier in IT field or solved
some problem, My Name is – RITESH KUMAR SINGH A/C number- 913010044116345 AXIS
Bank LTD :- Vaishali NCR, India-001
 

No comments:

Post a Comment