Skip to main content

Running tests on a remote machine using PassiveAgent

8 replies [Last post]
prammic
Offline
Joined: 2009-10-21
Points: 0

Hi,

I have been successfully running tests on my local machine. Now, I am trying to run my tests on a remote machine. I have a few questions regarding this:

1. Do i need to copy over all my tests into the remote machine before running them? I saw from another thread that I dont need to. As long as I have the compiled version of my tests in the local machine, they will get passed to the remote machine. Please clarify.

2. I have copied the javatest.jar file into the remote machine. I have kicked the PassiveAgent off using the following command:
java -classpath ./javatest.jar com.sun.javatest.agent.AgentMain -passive -trace -passivePort 9999
Is this correct? I dont see any errors when i kick this process off. So I'm assuming it's correct.

3. This is my understanding of the PassiveAgent as described in the Agent Guide. A passive agent is used when you want to run tests on a remote machine. The Javatest Harness initiates the running of the tests by passing the tests to be run to the passive agent. Is this understanding correct?

4. In the local machine where I have the Javatest Harness installed, I am pretty sure I need to specify the remote host name and the remote host port where the passive agent is running, I dont know where this needs to be done. The configuration interview asks only one question that is if i want to use JavaTest Agent or not. Please let me know where i need to configure these values.

5. Do i need to make any changes to the jtt file? the current jtt file i have is working perfectly to be run on my local machine.

6. whats the purpose of the Map file? Is the map file only to make sure certain strings get substituted on the remote machine to ensure correct running of the tests? Is there more to the map file?

I went through the whole of the Javatest Agent User Guide. I wasn't too clear with the above questions even after reading it. Please help me out.

Thanks,
Pradeep.

PS: The following is my jti file:

#JT Harness Configuration Interview
#Wed Oct 28 16:35:08 EDT 2009
CHECKSUM=4ed4d1b9632f5f4f
DESCRIPTION=helloworld
INTERVIEW=com.sun.javatest.interview.SimpleInterviewParameters
LOCALE=en_US
NAME=helloworld
QUESTION=simple.epilog
TESTSUITE=C\:\\jtharness\\examples\\tutorial\\helloworld
WORKDIR=C\:\\jtharness\\junit
simple.cmdType=agent
simple.concurrency.concurrency=1
simple.desc=helloworld
simple.excludeList.latestAutoCheck=No
simple.excludeList.latestAutoCheckInterval=7
simple.excludeList.latestAutoCheckMode=everyXDays
simple.excludeList.needExcludeList=No
simple.keywords.keywords.mode=expr
simple.keywords.needKeywords=No
simple.name=helloworld
simple.priorStatus.needStatus=No
simple.priorStatus.status=
simple.tests.needTests=No
simple.tests.tests=
simple.tests.treeOrFile=tree
simple.timeout.timeout=1

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bkurotsu
Offline
Joined: 2004-12-13
Points: 0

Ah, it's simply a defect in SimpleInterview, see bug 6847126. The exported class to execute should be ActiveAgentCommand.

It's fixed in the latest builds, give the latest 4.2.1 build 14 a try.

Brian

prammic
Offline
Joined: 2009-10-21
Points: 0

Brian,

You the man! Thanks ! I fixed the issue by editing the SimpleInterview class source file. I was flabbergasted thinking why the hell is it trying to execute a non-existent class!

I have successfully run a "Hello World" test on a remote machine. The way I did it was by copying the compiled tests to my remote machine running the active agent. This works fine. But it's painful to copy all the tests to different test machines each time. Is it possible to run the tests on a remote test machine [b]without[/b] copying the compiled test files ? Do i need to edit the ExecStdTestSameJVMCmd source file to request the test class files ? Or is there an easier way of doing this?

On pg 13 of the agent document, it says the classpath needs to contain the path to the classes directory containing the tests for the test suite. This statement suggests to me that when i kick the active agent off, the tests need to be in its classpath. Is my understanding correct? If it is then it is really painful to copy the compiled tests to all my test machines but i can live with it. Atleast i will be able to run them on different platforms.

Thank you very much for your earlier suggestion.
-Pradeep.

bkurotsu
Offline
Joined: 2004-12-13
Points: 0

You do not need the classes on the agent machine/device. Are the classes for the tests available at the location specified for the classpath= value in the jtt file?

prammic
Offline
Joined: 2009-10-21
Points: 0

Yes I do. the classpath value in the jtt file is pointing to the right location containing my tests.

However when i run the tests the agent throws the following error:
[b]TAG IS `com.sun.javatest.lib.ExecStdTestSameJVMCmd'
REQUEST IS `executeCommand'
CLASSNAME: com.sun.javatest.lib.ExecStdTestSameJVMCmd
nArgs: 1
arg[0]: helloworld.HelloWorld
mapArgs: false
remoteClasses: false
CLOSE TESTREF
CLOSE TESTLOG
RETURN Failed. Can't load test: java.lang.ClassNotFoundException: helloworld.HelloWorld
SEND STATUS
FLUSH
AWAIT CLOSE
[/b]

The only way I have been able to make the tests run on a remote machine is by copying all my tests to the remote machine and by starting the agent with the path to the tests on its classpath.

-Pradeep.

bkurotsu
Offline
Joined: 2004-12-13
Points: 0

> Hi,
>
> I have been successfully running tests on my local
> machine. Now, I am trying to run my tests on a
> [b]remote machine[/b]. I have a few questions
> regarding this:
>
> 1. Do i need to copy over all my tests into the
> remote machine before running them? I saw from
> another thread that I dont need to. As long as I have
> the compiled version of my tests in the local
> machine, they will get passed to the remote machine.
> Please clarify.

Correct. If you read the other thread though, you will see that you must use a particular code pattern to load any data files, since the transfer of things across the connection is facilitated by the class loader mechanism.

>
> 2. I have copied the javatest.jar file into the
> remote machine. I have kicked the PassiveAgent off
> using the following command:
> [b]java -classpath ./javatest.jar
> com.sun.javatest.agent.AgentMain -passive -trace
> -passivePort 9999[/b]
> Is this correct? I dont see any errors when i kick
> this process off. So I'm assuming it's correct.
>
> 3. This is my understanding of the PassiveAgent as
> described in the Agent Guide. A passive agent is used
> when you want to run tests on a remote machine. The
> Javatest Harness initiates the running of the tests
> by passing the tests to be run to the passive agent.
> Is this understanding correct?

Active agent is more common these days, but you can use Passive agent if you wish. I assume you read the limitations on p8 of the Agent User's Guide; clearly Active agent is more robust.

> 4. In the local machine where I have the Javatest
> Harness installed, I am pretty sure I need to specify
> the remote host name and the remote host port where
> the passive agent is running, I dont know where this
> needs to be done. The configuration interview asks
> only one question that is if i want to use JavaTest
> Agent or not. Please let me know where i need to
> configure these values.

Yes, the interview is currently written to use active agents. You need to rewrite part of the interview if you want to use passive agents.

> 5. Do i need to make any changes to the jtt file? the
> current jtt file i have is working perfectly to be
> run on my local machine.

Nope. Some things can be controlled there - mostly out of convenience. But if you are switching between active agents, passive, local execution, etc...you will want to write those capabilities into the interview. The jtt file isn't intended to be altered by individual users of a test suite on a regular basis or for configuration purposes (i.e. after the test suite is created).

> 6. whats the purpose of the Map file? Is the map file
> only to make sure certain strings get substituted on
> the remote machine to ensure correct running of the
> tests? Is there more to the map file?

Yes. No. Especially useful if agent is Windows and JavaTest side is *NIX. c:\work\foo.wav to /tmp/tsdata/foo.wav mapping.

See p8-9 of the guide.

> I went through the whole of the Javatest Agent User
> Guide. I wasn't too clear with the above questions
> even after reading it. Please help me out.

Now the LARGE disclaimer. I'm not sure which project you're working on, but we don't recommend using the built-in agent for any new test suites. It is mainly there for legacy purposes, although it may be suitable if you are a simple J2SE based test suite. The primary remote agent frameworks in use today are the cqMe (ME Framework) and JDTF - both under active development.

https://cqme.dev.java.net/
https://jdtf.dev.java.net/

I highly recommend reviewing those projects and discussing it in their forums before spending too much implementation time. Those are both built on top of JT Harness and have superior capabilities as compared to the provided agent. As background - the built-in JT agent was designed originally for a J2SE environment (i.e. lots of API and bandwidth), then updated for more limited ME operation (no sockets, serial, etc). As ME has grown, they far exceeded the capabilities of the built-in agent, hence the cqME and JDTS projects.

Sorry, this means more investigation for you, but I think it's worth it to get you on the right track early.

Brian

> Thanks,
> Pradeep.
>
> PS: The following is my jti file:
>
> #JT Harness Configuration Interview
> #Wed Oct 28 16:35:08 EDT 2009
> CHECKSUM=4ed4d1b9632f5f4f
> DESCRIPTION=helloworld
> INTERVIEW=com.sun.javatest.interview.SimpleInterviewPa
> rameters
> LOCALE=en_US
> NAME=helloworld
> QUESTION=simple.epilog
> TESTSUITE=C\:\\jtharness\\examples\\tutorial\\hellowor
> ld
> WORKDIR=C\:\\jtharness\\junit
> simple.cmdType=agent
> simple.concurrency.concurrency=1
> simple.desc=helloworld
> simple.excludeList.latestAutoCheck=No
> simple.excludeList.latestAutoCheckInterval=7
> simple.excludeList.latestAutoCheckMode=everyXDays
> simple.excludeList.needExcludeList=No
> simple.keywords.keywords.mode=expr
> simple.keywords.needKeywords=No
> simple.name=helloworld
> simple.priorStatus.needStatus=No
> simple.priorStatus.status=
> simple.tests.needTests=No
> simple.tests.tests=
> simple.tests.treeOrFile=tree
> simple.timeout.timeout=1

prammic
Offline
Joined: 2009-10-21
Points: 0

Can you please tell me why the harness is trying to execute the following command?

com.sun.javatest.agent.AgentCommand com.sun.javatest.lib.ExecStdTestSameJVMCmd helloworld.HelloWorld

The class AgentCommand does not exist in javatest.jar. What command is it supposed to execute when i run the tests?

I will explain the steps i have carried out so far in order to run the tests on a remote machine.

1. I took your advice, started the Active agent using the following command on my test machine running Linux:
/usr/jdk1.5.0_06/bin/java -classpath ./javatest.jar com.sun.javatest.agent.AgentMain -active -trace -activeHost pramanxp -activePort 9999

2. started the JT Harness GUI on my local machine running WinXP.

3. Configured a test to run a simple HelloWorld test using the JT Harness Agent using the interview.

4. Clicked on View>Agent Monitor. I put in 9999 for port number and checked the "Listening" check box.

5. After step 4 i see the active agent running on my test machine in the Agent Pool pane. On my test machine, I see "REQUEST FROM pramanxp,port=9999,localport=33430"
So im thinking the connection was successfully established.

6. Now i come back to my local machine. this machine has the helloworld test. i run the test, it fails with the message:
[b]Based on the results of the preceding sections, the script determined that the result of the test is:
Error. Cant find class "{0}", used in "{1}"[/b]

7. I examined the command it's trying to execute, I see it is trying to execute a non-existent class com.sun.javatest.agent.AgentCommand.

Please let me know what im doing wrong and how i rectify this.

Thanks for the help.
Pradeep.

Jonathan Gibbons

jtharness@mobileandembedded.org wrote:
> Can you please tell me why the harness is trying to execute the following command?
>
> com.sun.javatest.agent.AgentCommand com.sun.javatest.lib.ExecStdTestSameJVMCmd helloworld.HelloWorld
>
> The class AgentCommand does not exist in javatest.jar. What command is it supposed to execute when i run the tests?
>
> I will explain the steps i have carried out so far in order to run the tests on a remote machine.
>
> 1. I took your advice, started the Active agent using the following command on my test machine running Linux:
> /usr/jdk1.5.0_06/bin/java -classpath ./javatest.jar com.sun.javatest.agent.AgentMain -active -trace -activeHost pramanxp -activePort 9999
>
> 2. started the JT Harness GUI on my local machine running WinXP.
>
> 3. Configured a test to run a simple HelloWorld test using the JT Harness Agent using the interview.
>
> 4. Clicked on View>Agent Monitor. I put in 9999 for port number and checked the "Listening" check box.
>
> 5. After step 4 i see the active agent running on my test machine in the Agent Pool pane. On my test machine, I see "REQUEST FROM pramanxp,port=9999,localport=33430"
> So im thinking the connection was successfully established.
>
> 6. Now i come back to my local machine. this machine has the helloworld test. i run the test, it fails with the message:
> [b]Based on the results of the preceding sections, the script determined that the result of the test is:
> Error. Cant find class "{0}", used in "{1}"[/b]
>
> 7. I examined the command it's trying to execute, I see it is trying to execute a non-existent class com.sun.javatest.agent.AgentCommand.
>
> Please let me know what im doing wrong and how i rectify this.
>
> Thanks for the help.
> Pradeep.
> [Message sent by forum member 'prammic' (praman@opnet.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=369824
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
> For additional commands, e-mail: interest-help@jtharness.dev.java.net
>
>
Pradeep,

I don't know it if it still the case, but it used to be the case that
all the *Agent* classes were bundled separately in something like
jtAgent.jar. You should check that it on your classpath.

FWIW, the classes are bundled separately because they also need to be
loaded on the remote machine, and the remote machine may not be able to
handle a jar file as big as the complete javatest.jar.

-- Jon

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jtharness.dev.java.net
For additional commands, e-mail: interest-help@jtharness.dev.java.net

prammic
Offline
Joined: 2009-10-21
Points: 0

I think I know what the problem is,
The javatest.jar does NOT contain the com.sun.javatest.agent.AgentCommand class.

The following is the command which the Javatest Harness is trying to execute.
com.sun.javatest.agent.AgentCommand com.sun.javatest.lib.ExecStdTestSameJVMCmd $testExecuteClass $testExecuteArgs