Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Java Extreme Programming Cookbook phần 5
Đang chuẩn bị liên kết để tải về tài liệu:
Java Extreme Programming Cookbook phần 5
Tùng Anh
61
28
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Vấn đề với mã này nằm trong thực tế assertXXX () là gần như chắc chắn thực hiện trước khi các chủ đề bắt đầu bởi someAsynchronousMethod () có một cơ hội để làm công việc của mình. Chúng tôi thực sự cần phải làm một cái gì đó như thế này: 1. Gọi một phương pháp không đồng bộ. 2. Chờ cho đến khi phương pháp này là hoàn tất. 3. | Example 5-2 demonstrates how you can test the content of the top table. In this example the table is located based on the text found within its first cell using the WebResponse.getTableStartingWith method. Example 5-2. Simple table testing public void testPersonTable throws Exception WebConversation webConversation new WebConversation WebResponse response webConversation.getResponse http localhost 8080 news sampleTable.html get the HTML table with First Name as the text of its first non-blank cell WebTable table response.getTableStartingWith First Name assertEquals column count 2 table.getColumnCount assertEquals row count 3 table.getRowCount get the cell at row 2 column 0 TableCell cell table.getTableCell 2 0 assertEquals cell text Tanner cell.asText Once the WebTable object is located the test uses various methods on the WebTable class to obtain the number of rows and columns as well as to locate a TableCell at a particular position. While this approach is fine for simple tables it tends to be too fragile. People may redesign page layout frequently and this sort of test is sensitive to things like exact row and column positions. A better approach shown in Example 5-3 is to assign identifiers to critical portions of your tables. Example 5-3. Testing a table with identifiers public void testAccountTable throws Exception WebConversation webConversation new WebConversation WebResponse response webConversation.getResponse http localhost 8080 news sampleTable.html WebTable accountTable response.getTableWithID accountInfoTbl assertNotNull account table accountTable get the checking account number TableCell checkingCell accountTable.getTableCellWithID checkingAcctNbr assertEquals Checking account number 12345 checkingCell.asText Now by locating identifiers you can rearrange your table layout as you see fit. Unless you change the identifiers your tests continue functioning. Example 5-4 shows the HTML for the table being tested here so you can see what the id tag looks .
TÀI LIỆU LIÊN QUAN
Java™ Extreme Programming Cookbook
Java Extreme Programming Cookbook phần 1
Java Extreme Programming Cookbook phần 2
Java Extreme Programming Cookbook phần 3
Java Extreme Programming Cookbook phần 4
Java Extreme Programming Cookbook phần 5
Java Extreme Programming Cookbook phần 6
Java Extreme Programming Cookbook phần 7
Java Extreme Programming Cookbook phần 8
Java Extreme Programming Cookbook phần 9
crossorigin="anonymous">
Đã 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.