Solved

help in starting project in Costello for GUI testing

Posted on 2006-06-27
25
566 Views
Last Modified: 2009-07-29
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
Comment
Question by:BradB3030
  • 13
  • 12
25 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 16999290
> 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
 
LVL 35

Expert Comment

by:girionis
ID: 16999303
... or put them somewhere in the classpath,.
0
 
LVL 4

Author Comment

by:BradB3030
ID: 17002133
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
 
LVL 35

Expert Comment

by:girionis
ID: 17002207
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17002377
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
 
LVL 35

Expert Comment

by:girionis
ID: 17002635
> 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
 
LVL 4

Author Comment

by:BradB3030
ID: 17002743
This project has no .class files.  The .java files have the class constructors within them -- what do I do to access that class?
0
 
LVL 35

Expert Comment

by:girionis
ID: 17002773
Do a search for this file: WrrrClient .class
0
 
LVL 4

Author Comment

by:BradB3030
ID: 17003078
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
 
LVL 35

Expert Comment

by:girionis
ID: 17003385
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17003635
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
 
LVL 35

Expert Comment

by:girionis
ID: 17003656
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 4

Author Comment

by:BradB3030
ID: 17003713
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17004195
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
 
LVL 35

Expert Comment

by:girionis
ID: 17007235
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17010379
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
 
LVL 35

Expert Comment

by:girionis
ID: 17015864
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17019237
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
 
LVL 35

Expert Comment

by:girionis
ID: 17019742
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17020055
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
 
LVL 35

Accepted Solution

by:
girionis earned 400 total points
ID: 17029264
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17043910
is your Abbot script file saved to D:\?   or the classes directory?  that would help eliminate that question that I have.
0
 
LVL 4

Author Comment

by:BradB3030
ID: 17044017
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
 
LVL 4

Author Comment

by:BradB3030
ID: 17044035
Please post in here girionis to get the other 100 points:
http://www.experts-exchange.com/Programming/Q_21902753.html
0
 
LVL 35

Expert Comment

by:girionis
ID: 17048519
Thank you for accepting, glad I was of help :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now