Analysis of 1.2.3 Interface testability
The interface is clearly more simple than the UI, just need to know the protocol and parameters to complete a request, from the automation test implementation of the ease of view, there are several characteristics:
1) The automation cost of driving the execution interface is not high: Http,rpc,soap,rmi can encapsulate a client as an executor of the interface request according to the corresponding protocol.
2) Overall automation test cost-effective: The interface test is still a black box category, so it is less difficult than unit testing, and compared to the stability of UI Automation more reliable.
2. Interface test Tool selection
2.1 Common Test Tools
2.1.1 JUnit
JUnit is often used as a unit test framework for White-box testing, and some of the good features of the framework are:
1) provides a rich API to support a variety of logic to verify the correctness of results
2) Support use case code reusability through parameterization, @before, @after and other features
3) Suite mode supports batch operation of case
4) have a good presentation of the report
5) integrated with Eclipse IDE for ease of use
2.1.2 HttpClient
HttpClient is a feature rich Client programming toolkit that supports the HTTP protocol, with the following key features:
1) Encapsulates a method that implements all HTTP, such as Get,post,put,head
2) Support Redirect, Session hold
3) Support File upload
2.1.3 HttpUnit
HttpUnit is a test aid for HTTP requests that can handle the requirements of a Web test. Handles HTTP requests, session hold, redirects, and HTTP by simulating the behavior of the browser. Response do DOM parsing.
Compared to httpclient, the difference is:
1) HttpUnit can parse the result page returned by HTTP, such as DOM element positioning
2) HttpUnit can start a servlet himself to run the service under test
2.1.4 Htmlunit
Htmlunit is more powerful than HttpUnit, like a browser, Htmlunit is one of JUnit's extended test frameworks that simulates the browser's behavior, and developers can use the APIs they provide to manipulate the elements of a page. Htmlunit supports Http,https,cookie, the form's post and get methods, the ability to wrap HTML documents, the various elements of the page can be called as objects, and support for JavaScript is better.
2.1.5 Jwebunit
Jwebunit a Web testing tool based on HttpUnit and JUnit. can be used to verify link jumps, form input and submission, table contents, and more. Web. The correctness of the application attributes. It is easier to write a case than a htmlunit,jwebunit package.