WSTests

Contents



Unit Tests

There are multiple reasons why unit tests simplify the developers life. Especially some of them ;

  • speed up the development process (fast way to test new functionality)
  • give the developer confidence that code is correct
  • prevent from regressions

Unit tests are especially important for any kind of API we develop : either Internal or Friend or Stable.

I've put together some useful links/guides how to write unit tests:

- describes how to write unit tests for multiple scenarios (file objects, data objects)
- how to set up test dependencies

As the unit tests are concentrated primarily on individual classes and methods it's mostly the responsibility of individual developers to write unit tests !!!

List of Existing Unit Tests for WS Functionality

  • websvc.axis2 /* Milan */
  • websvc.clientapi /* Lukas */
  • websvc.customization /* Rico */
  • websvc.design /* Milan */
  • websvc.editor.hints
  • websvc.jaxwsapi /* Lukas */
  • websvc.jaxwsmodel /* Milan */
  • websvc.manager
  • websvc.projectapi /* Rico */
  • websvc.rest
  • websvc.saas.api
  • websvc.saas.codegen
  • websvc.saas.services.delicious /* Lukas */
  • websvc.saas.services.facebook /* Lukas */
  • websvc.saas.services.flickr /* Lukas */
  • websvc.saas.services.google /* Lukas */
  • websvc.saas.services.twitter /* Lukas */
  • websvc.saas.services.weatherbug /* Lukas */
  • websvc.saas.services.yahoo /* Lukas */
  • websvc.saas.services.zillow /* Lukas */
  • websvc.saas.services.zvents /* Lukas */
  • websvc.utilities
  • websvc.websvcapi /* Lukas */
  • websvc.wsitconf /* Martin Grebac */
  • websvc.wsitmodelext /* Martin Grebac */
  • websvc.wsstackapi /* Milan */

Note : most of the WS Functionality is covered very poorely (with unit tests).

Functional Tests

  • Test Automation
  • Test Guidelines
  • properties can be set on the command line, in nbbuild/user.build.properties or in somekit/nbproject/private/private.properties

Overall summary

Kit name Test count Test duration (min) Class Coverage Method Coverage
websvc.kit 65 27 75% 59%
websvc.restkit 37 18 90% 73%


Note: Tests were run on Toshiba TecraM9 - Intel Pentium M 2GHz, 3GB RAM, Ubuntu 8.10 against NetBeans 6.5 RC2

Running Tests

  • Prerequisites:
  • have a local installation of some supported server (GlassFish, Apache Tomcat, JBoss)
  • add test-qa-functional-sys-prop.glassfish.home=/space/to/glassfish-v2ur2 to nbbuild/user.build.properties
  • Running tests from the IDE:
  • open a test in the IDE
  • Run File
  • Running tests from command line:
cd $NB_ALL/websvc.kit
//will run "stable" tests (by default against GlassFish) in websvc.kit module
//will use default timeout (= 10mins) - can by overriden by -Dtest.timeout
//will overwrite test-qa-functional-sys-prop.glassfish.home from nbbuild/user.build.properties
ant test-qa-functional -Dtest.config=stable -Dtest-qa-functional-sys-prop.glassfish.home=/space/to/glassfish-v2ur2

Web Services core (JAX-WS Support)

Test sources are in websvc.kit module

  • Available test configurations:
Test Configuration Test Suite(s) Duration (mins)
stable HintsTests, WebServiceDesignerTest 5
validation HintsTests, WebServiceDesignerTest, WsValidation 13
all FullWsValidation(*), FromWSDLTSuite, HintsTests, WebServiceDesignerTest 27

Note: (*) FullWsValidation is a merge of WsValidation, EjbWsValidation, AppClientWsValidation and JavaSEValidation


Covered scenarios

  • Create new web service from Java in Web project
  • Add new web service operation using editor's context menu and action on the web service node
  • Set SOAP 1.2 on the web service
  • Set SOAP 1.1 on the web service
  • Create message handlers
  • Configure message handlers on created service (add, move, remove)
  • Deploy project
  • Call Test Web Service action on the web service
  • Call Generate SOAP-over-HTTP Wrapper action on the web service
  • Call Generate and Copy WSDL action on the web service
  • Redeploy project
  • Create new web service client in Web project
  • Call web service operation in servlet
  • Call web service operation in JSP
  • Call web service operation in regular Java class
  • Create message handlers
  • Configure message handlers on created client (add, move, remove)
  • Refresh Client
  • Deploy project
  • Create new web service from Java in EJB module project
  • Add new web service operation using editor's context menu and action on the web service node
  • Set SOAP 1.2 on the web service
  • Set SOAP 1.1 on the web service
  • Call Generate and Copy WSDL action on the web service
  • Create message handlers
  • Configure message handlers on created service (add, move, remove)
  • Deploy project
  • Call Test Web Service action on the web service
  • Create new web service client in EJB module project
  • Call web service operation in session EJB
  • Call web service operation in regular Java class
  • Create new web service from session EJB
  • Create message handlers
  • Configure message handlers on created client (add, move, remove)
  • Refresh Client
  • Deploy project
  • Create new web service client in AppClient module project
  • Call web service operation in Java Main Class
  • Call web service operation in regular Java class
  • Create message handlers
  • Configure message handlers on created client (add, move, remove)
  • Refresh Client
  • Run project
  • Create new web service client in JavaSE module project
  • Call web service operation in Java Class
  • Create message handlers
  • Configure message handlers on created client (add, move, remove)
  • Refresh Client
  • Run project
  • Create new web service from WSDL in Web project
  • Refresh service from WSDL
  • Add web service operation to ws from Java
  • Add web service operation to ws from Java which uses @WebService.endpointInterface
  • Call Show Sample Input action
  • Call Show Sample Output action
  • Call Switch to list view action
  • Call expand/collapse buttons
  • Call Go To Source action
  • Remove web service operation to ws from Java
  • Remove web service operation to ws from Java which uses @WebService.endpointInterface
  • Remove endpointInterface attribute
  • Remove Oneway annotation
  • Remove HandlerChain annotation
  • Remove SOAPMessageHandlers annotation
  • Remove mode attribute
  • Remove serviceName attribute


Identity Support

Test sources are in identity.kit module

  • Prerequisites:
  • have a local installation of JavaEE 5 SDK Update 4 (App Platform variant) with Access Manager 7.1 Patch1 add-on at /space/Sun/SDK or e:\space\SDK (can be overridden in build-qa-functional.xml)
  • after you have installed SDK Glassfish, you should start it once to let it to automatically configure Access Manager
  • Available test configurations:
Test Configuration Test Suite(s)
stable <empty>
validation IdentityValidation,IdentityValidationInEJB


Covered Scenarios

  • IdentityValidation
  • Add JavaEE 5 SDK Glassfish into IDE, start it and check Access Manager installed correctly
  • Edit Access Manager Profiles
  • Set AM Security in Web Service Provider in Web Application
  • Set AM Security in Web Service Client in Web Application
  • Deploy AM secured Web Applications and authenticate client to provider
  • IdentityValidationInEJB
  • Set AM Security in Web Service Provider in EJB Module
  • Set AM Security in Web Service Client in EJB Module
  • Deploy AM secured EJB Modules and authenticate client to provider
  • IdentitySamplesTest
  • testStockQuoteService
  • testStockQuoteClient

RESTful Web Services support

Test sources are in websvc.restkit module

  • Available Properties:
Property Name Default setting Property Description
plugins.jmaki.skip true skip jMaki related test
plugins.jmaki.nbm ${java.io.tmpdir}/org-netbeans-modules-sun-jmaki.nbm taken into account if plugins.jmaki.skip=false, allows one to skip downloading of nbm from http://ajax.dev.java.net

Note: these properties have to be prefixed by test-qa-functional-sys-prop.


  • Available test configurations:
Test Configuration Test Suite(s) Duration (mins)
stable CRUDTest, FromDBTest, PatternsTest, RestCStubsTest, RestNodeTest, RestSamplesTest 5+4+7+2+2+4 (24)
validation CRUDTest, FromDBTest, PatternsTest, RestCStubsTest, RestNodeTest, RestSamplesTest 5+4+7+2+2+4 (24)


Scenarios covered by test suites

  • Create new RESTful web services from Database
  • Deploy created application
  • Create new entity classes from sample DB
  • Create new RESTful web services from entity classes
  • Create new entity class with property based access
  • Create new RESTful web service from property based entity class (also tests the functionality of the wizard itself)
  • Call Test RESTful Web Services action
  • Deploy created application
  • Create new RESTful web service from patterns using Singleton pattern
  • Create new RESTful web service from patterns using Container-Item pattern
  • Create new RESTful web service from patterns using Client-Controlled Container-Item pattern
  • Create and deploy HelloWorld sample
  • Create and deploy Customer Database sample
  • Create and deploy Customer Database on Spring Sample
  • Create new RESTful web services client stub for existing project (created by CRUDTest)
  • Create new RESTful web services client stub from local WADL file
  • Check RESTful web services node visibility after opening a project
  • Check "Open" action on the resource node and its subnodes
  • Check dynamic adding/removing RESTful web service operation node to/from project logical view
  • same as CStubsTSuite but with use jMaki option in the wizard turned on


Scenarios covered by tests in sample project

How to run:

  • Have an IDE with enabled Groovy and RESTful Web Services plugins
  • Create new project: Samples -> Web Services -> Customer Database (RESTful)
  • Run Test RESTful Web Services action on the created project, copy REST test client folder generated in $PROJECT_HOME/build/generated/rest-test to $PROJECT_HOME/web/ and (re)deploy Customer Database sample project
  • Open TestClientTestApp project in the IDE - it's OK if there are some missing dependencies - they will be downloaded during a build
  • Run Test action on the TestClientTestApp project

Notes:
Default web browser used by tests is Firefox but any other browser supported by Selenium can be used - see TelluriumConfig.groovy
Default hostname and port used by tests is set to localhost:8080 - can be changed in RestTestClientTest itself
Default JDBC URL of Sample DB is used - can be changed in Utils.groovy if needed

  • do HTTP GET /resources/customers/ request using application/xml mime type
  • do HTTP GET /resources/customers/ request using application/json mime type
  • do HTTP GET /resources/customers/1 request using application/xml mime type
  • do HTTP GET /resources/customers/1 request using application/json mime type
  • do HTTP POST /resources/customers/ request using application/xml mime type (content)
  • do HTTP POST /resources/customers/ request using application/json mime type (content)
  • do HTTP PUT /resources/customers/1001/ request using application/xml mime type (content)
  • do HTTP PUT /resources/customers/1010/ request using application/json mime type (content)
  • do HTTP DELETE /resources/customers/1001/ request
  • do HTTP DELETE /resources/customers/1010/ request

To Be Done

Following table shows features for which we want to write functional tests.
Note: tests will be implemented in no particular order

Task Owner Notes
WS Designer, Add operation - from WSDL cases Lukas
WS Customization Lukas for now covered by TS_60_CustomizationEditor
WS Client Customization Jarda for now covered by TS_60_CustomizationEditor, Planned for 2008
WSIT stuff TBD
Use custom keystore for Identity Jarda Planned for 2008
Check AM Security vs WSIT behaviour Jarda Planned for 2008
Axis2 support
New ws client - dispatch
New ws from wsdl - provider
REST Spring support


Features not planned to be covered by functional tests

Following features will not be covered by automated qa-functional tests anytime soon:

  • JAX-RPC support
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo