Forum Discussion

sparrowenclave's avatar
sparrowenclave
Occasional Contributor
4 years ago
Solved

How to add oracle row record in properties test step as key value pair in Soap UI tool

In Soap UI, I am able to connect oracle database using groovy Script. then I fetched one record from the table.Now I wanted to know how we can set the record as key value in properties test step. ...
  • HimanshuTayal's avatar
    4 years ago

    sparrowenclave :

     

    I am hoping that you are doing same as below

    import groovy.sql.Sql;
    
    //Establish JDBC Connection to the DB
    def  con = Sql.newInstance(“jdbc:oracle:thin:@<url server database>:<port>:<sid>”, “username”, “password”, “oracle.jdbc.driver.OracleDriver”);
    
    def response = con.rows(“select * from employee”)
    
    //storing name in variable
    def name = response[0].name.toString()
    
    //setting name record in properties test step
    testRunner.testCase.getTestStepByName("Properties").setPropertyValue("emp_name",name)
    
    //closing DB Connection
    con.close()

     

    Hope it will help you in resolving your issue 🙂

  • HimanshuTayal's avatar
    HimanshuTayal
    4 years ago

     

    sparrowenclave :

     

    If the answer to the question is resolved in this question then it will advisable to ask new question in new thread, also you can ask in this too 🙂