jbuilder的向导中有一个ejb test的向导,可以通过它来写测试程序,实际上它都把测试程序写好了,你只要加个main函数调用就可以了。

解决方案 »

  1.   

    我用的weblogic,直接发布然后用jsp调用来测试。weblogic会给出出错信息的
      

  2.   

    你可以参看 jbuilder 随盘 提供的pdf 文档 里面有专门的介绍 Testing an enterprise bean那个pdf的名字叫  Enterprise JavaBeans™ Developer’s Guide的第9章 
      

  3.   

    TOMCAT站点上有个工具不错好象叫做curcet
      

  4.   


    http://jakarta.apache.org/cactus/index.html
    --------------------------------------------------------------------------------
     
     Last update: March 17 2003
    Docs for: v1.5dev | v1.4.1AboutWhat is Cactus?
    News
    Changes
    Features
    Goals
    Roadmap/Todo
    Contributors
    Contributing
    Cactus Users
    Tested on ...
    LicenseDownloadsDownloadsDocumentationHow it works?
    Getting Started
    Mock vs Container
    Javadocs
    FAQ
    Eclipse pluginHowto GuidesClasspath Howto
    Config Howto
    Migration Howto
    TestCase Howto
    Jsp Howto
    Runner Howto
    Security Howto
    Ant Howto
    HttpUnit Howto
    Sample Howto
    EJB Howto
    IDE Howto
    Tomcat Howto
    JUnitEE HowtoSupportBug database
    Mailing listMisc.Why the name?
    Logo Challenge
    Resources
    Test Coverage
    StatsDevelopersCVS
    Coding Conventions
    Build results
    Release Checklist
    Build from sourcesTranslationsKorean
    Japanese Project Description 
    Cactus is a simple test framework for unit testing server-side java code (Servlets, EJBs, Tag Libs, Filters, ...). The intent of Cactus is to lower the cost of writing tests for server-side code. It uses JUnit and extends it. Cactus implements an in-container strategy (See How it works). 
     
    The Cactus Ecosystem is made of several components: The Cactus Framework: This is the heart of Cactus. It is the engine that provides the API to write Cactus tests. 
    The Cactus Integration Modules: They are front ends and frameworks that provide easy ways of using the Cactus Framework (Ant scripts, Eclipse plugin, Maven plugin, ...). 
    The Cactus Samples: They are simple projects that demonstrate how to write Cactus tests and how to use some of the Integration Modules. 
     Different kinds of unit tests 
    There are several kinds of unit testing frameworks. We categorize them in 3 types: Type 1: code logic unit testing. Probably the best strategy for these tests is to use a Mock Objects type framework. 
    Type 2: integration unit testing. Cactus is typically in this category (I'll let you judge if it is the best or not :)). These tests will exercise the interactions with the container. 
    Type 3: functional unit testing. These unit tests will let you test the returned values from your server code. This is for example HttpUnit (Note that HttpUnit also performs standard functional testing - as opposed to functional unit testing -, which let you test full use cases - a login use case for example, which is comprised of several requests/responses). 
    Ideally you would use 3 different frameworks just to unit test your code ! Then you have to think about acceptance testing, system integration testing, ... Cactus was developed to fit Type 2 but also to be a very good compromise for Type 1 and 3, with the idea that it is much easier to have to write tests for a single framework than for several ! Moreover, you can never fully test your code. We believe Cactus provides a middle ground that provides a high confidence that your code will run when deployed. However, it is your choice and you can use Cactus only for Type 2 if you wish. 
     Getting Started 
    To get started, read the Getting Started guide. 
      
    --------------------------------------------------------------------------------
     
    Copyright © 2000-2003 The Apache Software Foundation. All Rights Reserved.  
      

  5.   

    http://www.cn-java.com/target/news.php?news_id=2261
      

  6.   

    我用的weblogic,先用jbuilder中的EJBTest测试,再发布后用jsp调用来测试
      

  7.   

    既然用D版
    何不用新的?8中带了cactus
      

  8.   

    shi ma ?jb8带了一个测试的吗?那太好了。
      

  9.   

    谁能调通jb7+websphere4.0AE中,能使用jb的ejb测试客湖端,我利马给他500分。决不失言。
      

  10.   

    很早前我用jb7试过,
    其实jb和websphere可以分开的。1。启动websphere;
    2.将ejb的类放入classpath中;
    3.写client,通过websphere“远程调用“ejb即可。也可配制server,启动server容器(和步骤一一样).其中websphere对语法要求非常严,一定要注意ejb接口串行化等。
      

  11.   

    楼上的可否详细的说说,我的msn:[email protected]
    或者给我邮件:
    [email protected]
      

  12.   

    new->enterprise->ejb test client
      

  13.   

    http://www.cn-java.com/target/news.php?news_id=2261
      

  14.   

    http://expert.csdn.net/Expert/topic/1605/1605233.xml?temp=.5053217
      

  15.   

    uphttp://expert.csdn.net/Expert/topic/1605/1605233.xml?temp=.5053217
      

  16.   

    file->new->enterprise->ejb test client
    选择你要测试的ejb,生成代码
    然后在main 方法里面先要调用create方法
    然后在调用你要测试的方法  public static void main(String[] args) {
        EjbtestClient2 client = new EjbtestClient2();
        client.create();
        //call your method you want to test for example
        System.out.println("user name"+client.getUserName());
     }
    屡试不爽!!!
      

  17.   

    问题,我已经自己解决。原因是websphere和weblogic不同,要自己生成.ear,然后,hot 部署,在用test client 才可以,等芒果着段日子,我奖总结出来,工大家参考。
      

  18.   

    不在一个包里,写另外一个应用,怎么访问ejb
    主要是环境怎么配置