WebSphere Studio Application Developer Version 5 Programming Guide part 62

WebSphere Studio Application Developer part 62 provides integrated development tools for all e-business development roles, including Web developers, Java developers, business analysts, architects, and enterprise programmers. The customizable, targeted, role-based approach of WebSphere Studio Application Developer will be characteristic of all new products built on the WebSphere Studio Workbench. It is well integrated with WebSphere Application Server and provides built-in server test environments that can be used for testing and profiling Web applications | JUnit supplied methods The assertEquals assertTrue and fail methods are provided by the JUnit framework. JUnit provides a number of methods that can be used to assert conditions and fail a test if the condition is not met. These methods are inherited from the class see Table 17-1 . Table 17-1 JUnit assert methods Method name Description assertEquals Assert that two objects or primitives are equal. Compares objects using equals and compares primitives using . assertNotNull Assert that an object is not null assertNull Assert that an object is null assertSame Assert that two objects refer to the same object. Compares using . assertTrue Assert that a boolean condition is true fail Fails the test All of these methods include an optional String parameter that allows the writer of a test to provide a brief explanation of why the test failed this message is reported along with the failure when the test is executed for example assertEquals String message object expected object actual . Creating a TestSuite A TestSuite is used to run one or more test cases at once. Application Developer contains a simple wizard to create a test suite. Select the package and New - Other - JUnit - TestSuite. Alternatively select the project folder and package after you start the wizard. The test classes window shows all test cases in the specified package selected by default. In our case BankingTestTest is shown and selected. The first page of the wizard is shown in Figure 17-7. 584 WebSphere Studio Application Developer Version 5 Programming Guide Figure 17-7 Create JUnit TestSuite By default the test suite is called AllTests. If you had multiple test classes you could include them in one suite. In our case we have only one test class. The check boxes to create a method stub for the main method does just that and we select that here as well as the check box to add a TestRunner statement. The generated AllTests Java source opens and requires a small .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
55    335    1    15-06-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.