51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3644|回复: 4
打印 上一主题 下一主题

关于用java编写测试脚本的疑惑

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2005-3-21 15:55:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
问题一:
这是配置的java环境,您看对不对 c:\j2sdk1.4.2_05,是jvm的路径,如果不正确,应该怎么配置啊

图一

图二






















问题二:我对这个窗口的理解是,当我的脚本中需要的函数都必须放到这个窗口中
这样理解对吗,它和图二里的classpath的设置的区别是什么啊






问题三:下面是我的测试脚本,我是把我在jbuider下运行通过的一个程序嵌入到loadrunner中,我的嵌入方法对吗

import lrapi.lr;

import java.net.*;
import java.io.*;
import java.util.*;


public class Actions
{

     public Socket clientSocket;
     private PrintWriter out;
     private BufferedReader in;
     private int bind = 0;
     public Object lockObject=new Object();

        public int init() {
                return 0;
        }//end of init


        public int action() {

         String resultStr;
         System.out.print("start connectioning...");
         try
         {
             clientSocket = new Socket( InetAddress.getLocalHost(),5000);
             //clientSocket.setSoTimeout(ICPConfig.ConnectTimeOut);
             //clientSocket.setSoTimeout(20000);
         }
         catch(Exception e)
         {

         }

         String bindStr = "this is a test";
         System.out.println(bindStr);
         try
         {
             SocketSend(bindStr);
         }
         catch(Exception e)
         {

         }
         try
         {
             resultStr = SocketRead();
             System.out.println( resultStr);
         }
         catch(Exception e)
         {

         }

             bind = 1;
        

                return bind;
        }//end of action


        public int end() {
                return 0;
        }//end of end


      public  void SocketSend(String xmlStr) throws Exception
   {

       {
          try
           {
               System.out.println("start sendfgxdgxg:");
               out = new PrintWriter(clientSocket.getOutputStream());
               System.out.println("start send:");
               out.println(xmlStr);
               out.flush();
               System.out.println("start end:");
          }
           catch(Exception e)
           {


           }

         }
    }



    public  String SocketRead() throws Exception
   {

      synchronized (lockObject) {

        InputStream ins = null;
         String xmlHeaderStr = new String();
         try
         {
             //in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
             ins = clientSocket.getInputStream();
             String readStr="";
             String readLine=null;


             byte[] xmlHeader = new byte[8];
             System.out.println("start read");
             ins.read(xmlHeader);
             //System.out.println("read header:" + new String(xmlHeader));
             xmlHeaderStr = new String(xmlHeader);
             System.out.println(xmlHeaderStr);


         }catch(Exception e )
         {
         }
       return xmlHeaderStr.trim();
      }


}


问题四:
经过上面的配置后,运行结果如下
Notify: Found jdk version: .        [MsgId: MMSG-22986]
Warning: Warning: Failed to find Classes.zip entry in Classpath.   [MsgId: MWAR-22986]
Notify: classpath=D:\teststudy\lrtestwinsocket5\;\\10.1.2.107\d\mercury interactive\mercury loadrunner\classes\srv;\\10.1.2.107\d\mercuryinteractive\mercury loadrunner\classes;C:\j2sdk1.4.2_05;;;        [MsgId: MMSG-22986]
Warning: Parameterization mechanism failed.        [MsgId: MWAR-22985]
Notify:Path=\\10.1.2.107\d\MERCUR~1\MERCUR~1\bin;F:\MERCUR~1\MERCUR~1\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;c:\j2sdk1.4.2_05\bin;c:\tomcat;        [MsgId: MMSG-22986]
Notify: VM Params: c:\j2sdk1.4.2_05.        [MsgId: MMSG-22986]
Error: Java VM internal error:Error Loading javai.dll. [MsgId: MERR-22995]
Warning: Extension java_int.dll reports error -1 on call to function ExtPerProcessInitialize        [MsgId: MWAR-10485]
Error: Thread Context: Call to service of the driver failed, reason - thread context wasn't initialized on this thread.        [MsgId: MERR-10176]


请问是为什么啊
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏

该用户从未签到

2#
 楼主| 发表于 2005-3-21 15:58:23 | 只看该作者
图片怎么传不上去啊
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2005-3-21 16:00:36 | 只看该作者
我用的url是,http://localhost/e:/tu1
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2005-3-21 16:02:52 | 只看该作者
晕倒,这样的url肯定不成啊
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2005-3-23 15:17:07 | 只看该作者
我也不知道,我也有同样的疑问,不知道java脚本怎么发到LOADRUNNER中去运行,还望斑竹多多指点一下
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-22 00:57 , Processed in 0.081502 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表