[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

help in starting project in Costello for GUI testing

Background:
I am trying to use Abbot and Costello for testing the functionality of a huge project made up of GUI components.  Basically it lets you perform actions in the GUI, records them into a script, and makes them into a test case, building on JUnit testing.
Here's a link if you want to get it, figure it out, and THEN help me: http://abbot.sourceforge.net/doc/overview.shtml

My situation:
I found the .bat that is used to run the project and it looks like this:
java -Xmx256m -cp wrrr.jar;diag_wrrr.jar;tool_sec.jar wrrr.client.WrrrClient arg1 arg2 arg3 arg4

So I'm trying to run a specific .java class that has a main thread that will start the whole project

What I've tried:
-I've tried pasting the .bat operation into the Launch line
-I've tried locating the specific WrrrClient.java file with the other parameters and using Run.

An example error I'm getting:
Error: c:\workspace\Wrrr\wr\client\WrrrClient                      <--- This is the correct path!
java.lang.ClassNotFoundException: c:\workspace\Wrrr\wr\client\WrrrClient
      at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source)
      at abbot.script.Launch.resolveClass(Launch.java:213)
      at abbot.script.Launch.getTargetClass(Launch.java:231)
      at abbot.script.Call.getMethods(Call.java:218)
      at abbot.script.Call.invoke(Call.java:162)
      at abbot.script.Call.runStep(Call.java:129)
      at abbot.script.Launch.synchronizedRunStep(Launch.java:138)
      at abbot.script.Launch.runStep(Launch.java:203)
      at abbot.script.Step.run(Step.java:93)
      at abbot.script.StepRunner.runStep(StepRunner.java:274)
      at abbot.script.Sequence.runStep(Sequence.java:110)
      at abbot.script.Script.runStep(Script.java:501)
      at abbot.script.StepRunner.runStep(StepRunner.java:271)
      at abbot.script.StepRunner.run(StepRunner.java:191)
      at abbot.editor.ScriptEditor$LaunchAction.run(ScriptEditor.java:2616)
      at java.lang.Thread.run()V(Unknown Source)

The WrrrClient.java class is in my Eclipse project, so I know it's there.  

Reason for the question:
  I've never used Abbot or Costello before, so I'm sure this could just be a small syntax thing.  I do believe I can get the help for this here:

My question:
How can I open my GUI program in Costello to being recording actions?  Help me through my case.

Thanks in advance,
Brad
0
BradB3030
Asked:
BradB3030
  • 13
  • 12
1 Solution
 
girionisCommented:
> c:\workspace\Wrrr\wr\client\WrrrClient                      <--- This is the correct path!

It is the correct path but Eclipse obviously does not look into there when it is searching for classes. Can you add that to the classpath your project is using?
0
 
girionisCommented:
... or put them somewhere in the classpath,.
0
 
BradB3030Author Commented:
One thing though, I'm not sure it's even using Eclipse.  Abbot/Costello looks like a standalone program when it's recording.  When applying the scripts to a test case is when you get into Eclipse code.

The batch file that runs Abbot/Costello for recording scripts runs these two lines to launch it:
C:\eclipse2\plugins\abbot-1.0.0rc2>set CP="lib\abbot.jar"
C:\eclipse2\plugins\abbot-1.0.0rc2>java -jar "lib\abbot.jar"


I'm confused about what you mean by this:
"Can you add that to the classpath your project is using?"
"or put them somewhere in the classpath"
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
girionisCommented:
It is looking for a class file that cannot be found. This means that it is either missing or that it is in a wrong location. The file that cannot be found is the WrrrClient.class file. Where is this file? You will need to put it in the classpath in order to run your application.
0
 
BradB3030Author Commented:
The file that should start the event is this:
c:\workspace\Wrrr\wr\client\WrrrClient.java


I'll be way more specific and say each of the input boxes in this Test Script Editor (Costello)

Target Class Name:   c:\workspace\WebRules\wr\client\WebrulesClient.java
Method:                    main
Arguments:               arg1 arg2 arg3 arg4
Classpath:                 c:\workspace\WebRules\wr\client


Is the problem that it can't read a .java file?  In Eclipse I am able to use those arguments (all Strings) to pass to the main([]) method and it loads the program correctly.

What am I missing?
0
 
girionisCommented:
> Classpath:                 c:\workspace\WebRules\wr\client

This should point to where your *.class* files are not the .java files. Where is your WrrrClient .class file?
0
 
BradB3030Author Commented:
This project has no .class files.  The .java files have the class constructors within them -- what do I do to access that class?
0
 
girionisCommented:
Do a search for this file: WrrrClient .class
0
 
BradB3030Author Commented:
k coolio, I didn't know I had this and the whole "class name" vs. ".java file" was making me uncomfortable.

I tried a couple of things for the parameters because I just don't know exactly what to do.

This is the class location:
c:\workspace\Wrrr\target\classes\wr\client\WrrrClient.class

So what should go into the parameters to make this work?
-- main method
-- 4 parameters
-- possibly need the "java -Xmx256m -cp wrrr.jar;diag_wrrr.jar;tool_sec.jar" stuff...?  Don't need them to launch the program from Eclipse...

The project name is Wrrr
and you access this area by navigating to Wrrr.wr.client.WrrrClient

Points will be awarded as soon as I can get the GUI to launch, I won't ask for support past that point...

Thanks for your quick responses, it's greatly appreciated!
Brad
0
 
girionisCommented:
Two things you can do. Either put this folder: c:\workspace\Wrrr\target\classes\wr\client\ into your classpath or copy/paste the WrrrClient .class file into c:\workspace\WebRules\wr\client (since it is already in your classpath). Then try to re-run your application.
0
 
BradB3030Author Commented:
Have you used Abbot before?

I tried this and it still came up with a ClassNotFoundException.

There are just a number of things I have to guess about...
- whether or not to include
- whether or not to put quotation marks around the parameters
- whether or not to put the parameters on separate lines using the + button
- whether or not to put the full path of the .class file in the launch
- where the location of the .xml script file should be located and whether it makes a difference
- whether the .class file needs to be something Eclipse can open (when I try to open WrrrClient.class, it says Source not found, there is no source file attached to the class file)

So I really need someone that has gotten an Eclipse project to work in this manner to just tell me how things need to be set to work properly.

Thanks again,
Brad
0
 
girionisCommented:
I haven't used Abbot before but running it shouldn't b any different than running any other application. Can you tell me how you are running it? Are you running it via Eclipse or via command line?
0
 
BradB3030Author Commented:
Uh, it's a standalone program, I launch it using an abbot.bat file, so I'm not running it through Eclipse, I'm running it through a GUI that's started via command line.

In the program there are textboxes for the inputs to launch the application.

Launch:                     ????
Target Class Name:   c:\workspace\WebRules\target\wr\client\WebrulesClient
Method:                    main
Arguments:               arg1 arg2 arg3 arg4
Classpath:                 c:\workspace\WebRules\target\wr\client

It's open-source and I gave the link, it would be really quick to check out.
0
 
BradB3030Author Commented:
If you'd like to bail on the question, please post saying so...I think it makes others more willing to chime in so they don't feel like they're "stealing your points"  You'll still get an assist for helping me with the class thing if that turns out to be the issue.
0
 
girionisCommented:
We will find the problem, it is a classpath issue so it shouldn't be that hard to track it. I ran Abbot, and I got an idea what this is about.

Are you still get the *same* error or is it complaining for other classes? If it is the same error can you tell where your WrrrClient.class is now? It is in c:\workspace\WebRules\target\wr\client\WrrrClient.class ?
0
 
BradB3030Author Commented:
I run the program in Eclipse with a .java file, does it have to be a .class?

I can definitely navigate to that WrrrClient.class file here:   c:\workspace\WebRules\target\wr\client\WrrrClient.class
The ClassNotFound is always for WrrrClient, not for any classes that it's referencing...

I tried another random class that had a valid .class file with a main subroutine in it and it showed the same type of error:

Error: java.lang.ClassNotFoundException: c:\workspace\TestOmitHRReport\elimHRReport
in step 'Launch c:\workspace\TestOmitHRReport\elimHRReport.main([])'
at C:\workspace\WebRules\WebRulesClientGUITest.xml:4
java.lang.ClassNotFoundException: c:\workspace\TestOmitHRReport\elimHRReport
      at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source)
      at abbot.script.Launch.resolveClass(Launch.java:213)
      at abbot.script.Launch.getTargetClass(Launch.java:231)
      at abbot.script.Call.getMethods(Call.java:218)
      at abbot.script.Call.invoke(Call.java:162)
      at abbot.script.Call.runStep(Call.java:129)
      at abbot.script.Launch.synchronizedRunStep(Launch.java:138)
      at abbot.script.Launch.runStep(Launch.java:203)
      at abbot.script.Step.run(Step.java:93)
      at abbot.script.StepRunner.runStep(StepRunner.java:274)
      at abbot.script.Sequence.runStep(Sequence.java:110)
      at abbot.script.Script.runStep(Script.java:501)
      at abbot.script.StepRunner.runStep(StepRunner.java:271)
      at abbot.script.StepRunner.run(StepRunner.java:191)
      at abbot.editor.ScriptEditor$LaunchAction.run(ScriptEditor.java:2616)
      at java.lang.Thread.run()V(Unknown Source)


Like I said earlier, I suspect it's probably one of these things:
- stupid mistake of wording or simply not knowing what the wording should be
- location of the test file
- location of the abbot files
- Something messed up with the .class files perhaps.

Thanks again,
Brad
0
 
girionisCommented:
Ok try something else, when you run abbot, in the classpath click on the + sign and then put this: c:\workspace\WebRules\target\wr\client in there and try to rerun it. Tell me if it helps.
0
 
BradB3030Author Commented:
A little bit different error:

Error: wr/client/WrrrClient : (wrong name WrrrClient)
java.lang.NoClassDefFoundError: wr/client/WrrrClient : (wrong name WrrrClient)
      at java.lang.ClassLoader.defineClass(Ljava.lang.String;[BIILjava.security.ProtectionDomain;)Ljava.lang.Class;(Unknown Source)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at abbot.util.NonDelegatingClassLoader.findClass(NonDelegatingClassLoader.java:32)
      at abbot.script.AppClassLoader.findClass(AppClassLoader.java:144)
      at java.lang.ClassLoader.loadClass(Ljava.lang.String;Z)Ljava.lang.Class;(Unknown Source)
      at abbot.util.PathClassLoader.loadClass(PathClassLoader.java:44)
      at abbot.util.NonDelegatingClassLoader.loadClass(NonDelegatingClassLoader.java:42)
      at java.lang.ClassLoader.loadClass(Ljava.lang.String;)Ljava.lang.Class;(Unknown Source)
      at java.lang.ClassLoader.loadClassFromNative(ILjava.lang.String;)Ljava.lang.Class;(Unknown Source)
      at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source)
      at abbot.script.Launch.resolveClass(Launch.java:213)
      at abbot.script.Launch.getTargetClass(Launch.java:231)
      at abbot.script.Call.getMethods(Call.java:218)
      at abbot.script.Call.invoke(Call.java:162)
      at abbot.script.Call.runStep(Call.java:129)
      at abbot.script.Launch.synchronizedRunStep(Launch.java:138)
      at abbot.script.Launch.runStep(Launch.java:203)
      at abbot.script.Step.run(Step.java:93)
      at abbot.script.StepRunner.runStep(StepRunner.java:274)
      at abbot.script.StepRunner.run(StepRunner.java:191)
      at abbot.script.Launch.launch(Launch.java:164)
      at abbot.editor.ScriptEditor$LaunchAction.run(ScriptEditor.java:2612)
      at java.lang.Thread.run()V(Unknown Source)


The test file looks like this and it's located in c:\workspace\WebRules\wr\client still -- does that matter?
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript awt="true">
  <launch args="[arg1 arg2 arg3 arg4]" class="WrrrClient" classpath="c:\workspace\WebRules\target\classes\wr\client\" method="main" />
  <terminate />
</AWTTestScript>
0
 
girionisCommented:
Ok, I am a bit lost now, can you post the source code of the class that you are trying to run so I can try it here as well? Also can you tell me the exact steps you are taking in order to run your class?
0
 
BradB3030Author Commented:
Unfortunately, I can't do that, the source code is too large, I WILL put each of my parameters and some of the important stuff from the code...hopefully you can pick up on something obvious that I am missing.

In Eclipse, I right click on WebrulesClient.java (NOTE: .java, not .class to get it to run in Eclipse) and press Run As...Run -- this pops up a menu
In the Main tab:  Project: WebRules     Main class: wr.client.WebrulesClient is the "Main Class
in the Arguments tab:  Program Arguments:  arg1 arg2 arg3 arg4    (no commas/brackets, just spaces)

Right now it's not putting that menu on the right side of my screen so I'm just Launching this:
'Launch WrrrClient.main([arg1 arg2 arg3 arg4])'

The XML for the test script is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<AWTTestScript>
  <launch args="[arg1 arg2 arg3 arg4]" class="WrrrClient" classpath="c:\workspace\WebRules\target\classes\wr\client\" method="main" />
  <terminate />
</AWTTestScript>


****** CODE WRRRCLIENT.JAVA ***********
  public static void main(String[] args)
  {
    if(args.length >= 4)
    {
      WrrrClient client = new WebrulesClient(args[0].trim(), args[1].trim(), args[2].trim(), args[3].trim());
    }
    else
    {
      JOptionPane.showMessageDialog(new JPanel(), "You must specify a server, region, rmi service, and port!", "ERROR", JOptionPane.ERROR_MESSAGE);
      if(remoteClient != null)
      {
        remoteClient.disconnectClient();
      }                  
    System.exit(0);
    }
  }

  public WebrulesClient(String newServer, String newRegion, String serviceName, String servicePortString)
  {
    super();
    if(!newServer.trim().equalsIgnoreCase(""))
    {
      server = newServer.trim();
      region = newRegion.trim();
      service = serviceName.trim();
      servicePort = (new Integer(servicePortString.trim())).intValue();

      wrrr_DO = new Wrrr_DO();
      remoteClient.connect();
      remoteClient.setClientInterface(this);
      gui_DO = new GUI_DO();

      PasswordPanel passwordPanel = new PasswordPanel(this);
      runner = new Thread(this);
      runner.start();
    }
    else
    {
      JOptionPane.showMessageDialog(this, "You must specify a server!", "ERROR", JOptionPane.ERROR_MESSAGE);
      if(remoteClient != null)
      {
        remoteClient.disconnectClient();
      }
      System.exit(0);
    }
  }


I am expecting the password panel to be the first thing that shows up.
Hopefully I'm not ignoring something totally obvious about the Abbot framework that needs to be here for it to work.

Thanks again for your help.
Brad
0
 
girionisCommented:
Ok, I wrote a very simple class and I will tell you what steps I took in order to run it in costello/Abbot.

First my class is this:

package fileupload;

import java.io.File;
import java.net.URI;

/**
 *
 * @author PAKONSTA
 */
public class Main {
   
    /** Creates a new instance of Main */
    public Main() {
    }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception
    {
        System.out.println(args[0] + " " + args[1]);
    }
   
}

I compiled it and the Main.class file is in the location: D:\NetBeansProjects\FileUpload\build\classes\fileupload\Main.class
I started Abbot and then a new script.

In the Target Class Name I have: fileupload.Main
In the Method I have: main
In the Arguments I have: [hello, there]
In the Classpath I have: \NetBeansProjects\FileUpload\build\classes

When I run it it prints on the console: hello there

Can you run your own classes based on the information above? You should change the classpath, the arguments and target class name to match your own data. The method should remain the same (main).
0
 
BradB3030Author Commented:
is your Abbot script file saved to D:\?   or the classes directory?  that would help eliminate that question that I have.
0
 
BradB3030Author Commented:
Hooray, I got the password panel to show up, it's pretty rough and I have a lot of work ahead of me, but that hurdle is cleared!

things I learned:
1. Make sure for your classpath that you put your general /classes/ directory, don't put any subdirectories like /classes/wr/client -- it won't work.
2. In the target class name, that is where you put wr.client.WrrrClient  -- if you have class files in wr.test or something and you only have client.WrrrClient here because you got the class name wrong, it probably won't find the wr.test ones.  Make sure your target starts from the classes directory and goes to the one you want to start
3. In parameters, don't use quotes and separate them with commas.   [arg0, arg1, arg2, arg3]
4. You can save the Abbot script file in the abbot directory and it works fine.
0
 
BradB3030Author Commented:
Please post in here girionis to get the other 100 points:
http://www.experts-exchange.com/Programming/Q_21902753.html
0
 
girionisCommented:
Thank you for accepting, glad I was of help :)
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 13
  • 12
Tackle projects and never again get stuck behind a technical roadblock.
Join Now