It is currently Wed Feb 08, 2012 11:49 pm



Welcome
Welcome to RHAPSODY4YOU

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, respond to polls, upload and download content, and access many other special features. Registration is fast, simple, and absolutely free, so please, register to join our community today.





 Page 1 of 1 [ 2 posts ] 
Author Message
 Post subject: First foray into the API
PostPosted: Mon Dec 14, 2009 5:42 pm 

Joined: Wed May 07, 2008 3:50 pm
Posts: 148
Location: Horsham, W Sussex, England
I am looking at automating tests with Test Conductor.
The first choice seems to be whether to use the command line or the Java API.
I guess the Java API would be more powerful and might mean less maintenance.
What do you think?

If I plump for the Java API, it seems that the sample TestConductorAPI_ExecuteFailedTests.java relies on the Rhapsody application already being open before it runs. It calls getActiveRhapsodyApplication().

Now, if this is fully automated, (say it's part of an overnight build) then I don't want to open a Rhapsody project manually before executing the API program.

I guess I'd have to use a script with command line commands which open the Rhapsody project beforehand. Is this right? What does everyone else do?


Offline
 Profile  
 
 Post subject: Re: First foray into the API
PostPosted: Fri Jan 29, 2010 3:44 pm 

Joined: Fri Jan 16, 2009 2:02 pm
Posts: 14
Hi,

with the Java API you can open your Rhapsody project Update, Build and excecute yout TestPackage.
The Support of TestConductor provided as a sample application, that we need to adapt.

The code for starting Rhapsody looks like:
public synchronized boolean startRhapsody() throws Exception
   {      
      String sCommand = ""+EnvironmentVariable.RHAPSODY_INSTALL_PATH+"\\rhapsody.exe "+ this.s_mOptionalArguments + " -cmd=open " + m_sModelPath;
      System.out.println("Executing command: "+ sCommand); System.out.flush();
      
      Process rhpprocess = null;
      
      try{
          rhpprocess = Runtime.getRuntime().exec(sCommand);
      }catch(IOException e)
      {      
         System.out.println("An exception occurred in startRhapsody: "+e.getMessage());
         System.out.println("StackTrace: \n"); System.out.flush();
         e.printStackTrace();
         throw e;
      }
      
      stdOutFile=File.createTempFile("TestExecuter",".out");  //$NON-NLS-1$//$NON-NLS-2$
      stdErrFile=File.createTempFile("TestExecuter",".err");
      
      MyFd outFd = new MyFd(rhpprocess.getInputStream(),stdOutFile);
      outFd.start();
      
      MyFd errFd = new MyFd(rhpprocess.getErrorStream(),stdErrFile);
      errFd.start();
      // wait
      //exitValue = rhpprocess.waitFor();

      return true;
   }


For Test update/build/execution they got a bunch of "Helper-Functions"

Roy


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

cron

suspicion-preferred