With the development of Internet / intranet, the development model changes: the first important technique is HTTP / HTML, which brings an important impact on Internet / Intranet and e-commerce; the second technology is the rise of Java technology. Java brings a cross-towering machine, allowing developers to use a single language and environmental development application system; the third is the rise of XML technology, which provides a standard data package, allowing data exchange to span all kinds of platforms , Operating systems and various tools, through XML, various data exchange no longer headache.
The concept of webservice is to use a standard output interface to define the functionality provided by the code so that the outside world can be called through this standard output interface, and the so-called standard output interface is WSDL, WSDL is an XML composed file, describing the implementation The procedure provides the prototype of the function, and the client can call the service code provided by the program via WSDL.
During the testing WebService interface, modern increasingly mature computer software technology provides a lot of simple and viable methods for testing WebService, which greatly reduces programmers' encoding amount, but a wide variety of tests Method, its convenience and performance, there is a big difference, the following will introduce a method of generating client test code using JBuilder (IDE), the method is convenient, the test code is quite simple, and the client is written as long as you write a few You can complete the WebService interface call:
I. Automatic generation of customer code
This article assumes that there is already a WebService interface, and the client program can complete some of the customer's functionality, and its test code automatically generates the steps:
1. First, use JBuilder to create a new project.
2. Select the New menu in the toolbar and select the Web Service option panel;
3. Select the Import A Web Service function block. Click the "OK" button to generate the "IMPORT A Web Service With Axis" generated navigation panel, select or enter the URL of the Web Service interface you want to test if you want to test. You need to provide access to usernames and passwords, enter your username and password, without providing these inputs without providing these inputs.
4. After entering the URL, click "Next", the "Choose a Server-Side Classes" prompt appears. This prompt is asked if you want to create a class of the server, because the topic discussed in this article is the client code, so the hook CHECKBOX to "Generate Server-Side Class", click "Next" to enter the next operation step.
5. Check the "Generate JUnit Testcase" and "Generate Wrapped Style Types", click "Finish".
After passing the above steps, the automatic generation of the WebService interface client test code is complete.
Second test
Choose a class file with TestCase, the test code can be added therein, which encapsulates all interface test methods defined in the WebService interface, select the code method you want to test, add a test instance to complete the interface method. test.