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.
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()); } 屡试不爽!!!
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.
何不用新的?8中带了cactus
其实jb和websphere可以分开的。1。启动websphere;
2.将ejb的类放入classpath中;
3.写client,通过websphere“远程调用“ejb即可。也可配制server,启动server容器(和步骤一一样).其中websphere对语法要求非常严,一定要注意ejb接口串行化等。
或者给我邮件:
[email protected]
选择你要测试的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());
}
屡试不爽!!!
主要是环境怎么配置