Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Jubula » Searching for AUT-Path-Parameter instead of AUT-Config
Searching for AUT-Path-Parameter instead of AUT-Config [message #912784] Fri, 14 September 2012 07:24 Go to next message
Johann Vogel is currently offline Johann VogelFriend
Messages: 20
Registered: February 2012
Junior Member
Is there an alternative to the -c Parameter of testexec? I want to directly specify a path to an (RCP) application to automatically test different (release)versions of an application with different paths, without manually needing to replace the Path in Test -> Property -> <AUTNAME> -> <AUTOCONFIG>. Is there a way to quick-change this via command-line.

A possible workaround is directly accessing this property with a script via SQL, but a Parameter would make this easier.

Edit: I already have written a workaround in groovy for that this morning. Oracle drivers in groovy-lib needed.

def updateWorking(conn, user, password, autname, exepath, workpath) {
    driver = oracle.jdbc.driver.OracleDriver
    sql = groovy.sql.Sql.newInstance(conn,user,password) 
    
    //find out ID of AUT by name
    sql.eachRow("select AUT_CONF from AUT_CONF_ATTR where ATTR_VALUE LIKE '"+autname+"'") {row -> id = row[0]}
    //update exepath and workpath
    sql.executeUpdate("update AUT_CONF_ATTR set ATTR_VALUE='"+exepath+"' where AUT_CONF = "+id+" and ATTR_KEY like 'EXECUTABLE'")
    sql.executeUpdate("update AUT_CONF_ATTR set ATTR_VALUE='"+workpath+"' where AUT_CONF = "+id+" and ATTR_KEY like 'WORKING_DIR'")
}

//call of function
updateWorking('jdbc:oracle:thin:@***:TESTDB', "JUBULA", "***", "MSS@localhost",$/E:\***.exe/$, $/E:\***/$)


Edit2: Javacode because groovy made problems with the classloading
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;


public class Dbsetter {

	public static void main(String[] args) {
		System.out.println("Exe: "+args[0]);
		System.out.println("Path: "+args[1]);
		connect("jdbc:oracle:thin:@*:1521:TESTDB", "JUBULA", "*", "*@localhost",args[0], args[1]);
	}

	private static void connect(String url, String username, String password, String autname, String exe, String path) {
		Connection connection = null;
		try {
		    // Load the JDBC driver
		    String driverName = "oracle.jdbc.driver.OracleDriver";
		    Class.forName(driverName);

		    connection = DriverManager.getConnection(url, username, password);
		    
		    PreparedStatement ps = connection.prepareStatement("select AUT_CONF from AUT_CONF_ATTR where ATTR_VALUE LIKE ?");
		    ps.setString(1, autname);
		    ps.execute();
		    ResultSet rs = ps.getResultSet();
		    int id=-1;
			while(rs.next())	
				id=rs.getInt(1);
			System.out.println("Aut-ID of "+autname+" is "+id);

			PreparedStatement ps2=connection.prepareStatement("update AUT_CONF_ATTR set ATTR_VALUE=? where AUT_CONF = ? and ATTR_KEY like 'EXECUTABLE'");
			ps2.setString(1, exe);
			ps2.setInt(2, id);
			PreparedStatement ps3=connection.prepareStatement("update AUT_CONF_ATTR set ATTR_VALUE=? where AUT_CONF = ? and ATTR_KEY like 'WORKING_DIR'");
			ps3.setString(1, path);
			ps3.setInt(2, id);
			ps2.execute();
			ps3.execute();
			System.out.println("Update done!");
		    
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		    // Could not find the database driver
		} catch (SQLException e) {
			e.printStackTrace();
		    // Could not connect to the database
		}
	}
}

[Updated on: Tue, 18 September 2012 07:18]

Report message to a moderator

Re: Searching for AUT-Path-Parameter instead of AUT-Config [message #921727 is a reply to message #912784] Mon, 24 September 2012 11:29 Go to previous messageGo to next message
Johann Vogel is currently offline Johann VogelFriend
Messages: 20
Registered: February 2012
Junior Member
*Pushing this thread*
I really need an answer to this, because the workaround is unsatisfying for more parallel runs on multiple hosts that would overwrite the same config with different data.

Is there a way to directly specify the exe or to override the path from the autconfig?
Re: Searching for AUT-Path-Parameter instead of AUT-Config [message #921812 is a reply to message #921727] Mon, 24 September 2012 12:59 Go to previous message
Achim Loerke is currently offline Achim LoerkeFriend
Messages: 357
Registered: July 2009
Location: Braunschweig, Germany
Senior Member

I don't get the problem. You can always specify a few AUT configs for every release version and use those as parameters to testexec. You may even use an AUT config which starts the AUT be calling a command script and change the actual AUT in this script.

There is no way to select AUT config parameter details with command line options right now, and there is nothing planned to work in that direction.

You should also be aware that the db scheme is not API and may change without notice.

Achim
Previous Topic:How to record a testcase using Observation mode for HTML
Next Topic:5009: AUT start failed
Goto Forum:
  


Current Time: Sun Dec 21 21:33:47 GMT 2014

Powered by FUDForum. Page generated in 0.03615 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software