Kiểm thử giao diện người dùng của ứng dụng web dựa trên nội dung
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hoạt động kiểm thử là rất quan trọng để đảm bảo chức năng, chất lượng, khả năng hỗ trợ tiếp cận, tính bảo mật và hiệu suất của ứng dụng web dựa trên nội dung. Hoạt động kiểm thử cho phép bạn đánh giá trải nghiệm người dùng và xác định xem liệu có cần phát triển thêm hay không. Ứng dụng web của bạn phải đáp ứng các tiêu chuẩn về chất lượng và hoạt động như mong đợi.
Bài viết này cung cấp hướng dẫn kiểm thử cơ bản để bạn cân nhắc việc làm cho ứng dụng web có thể truy cập và thân thiện với người dùng.
Thành phần |
Độ tương phản màu |
Đảm bảo tỷ lệ tương phản được tối ưu hoá để dễ đọc. Bạn cần kiểm tra nhiều loại mù màu và các màu bắt buộc có độ tương phản cao do người dùng xác định.
|
Kiểu chữ |
Xác định xem ứng dụng có phù hợp với nhiều thiết bị và chế độ cài đặt hay không. Khi sử dụng cỡ chữ tương đối và chuyển tỷ lệ không tuyến tính, kiểu chữ vẫn có thể dùng được trên kích thước tối đa.
|
Hình ảnh |
Đảm bảo rằng hình ảnh có chất lượng cao và có thể tải nhanh. Điều quan trọng là bạn phải kiểm tra các bản dự phòng chính xác không có mạng và thành phần được tối ưu hoá cho độ phân giải cao hơn.
|
Thao tác |
Đảm bảo rằng các thành phần điều hướng rõ ràng và có thể sử dụng bằng chuột, chạm và bàn phím.
Việc kiểm tra API nhật ký đảm bảo tính năng điều hướng quay lại và tiến cũng được giữ nguyên chính xác.
|
Tìm kiếm |
Kiểm tra độ trễ thấp của thời gian phản hồi đối với các truy vấn trong trường tham số truy vấn URL và trường tìm kiếm.
|
Biểu mẫu |
Đảm bảo rằng tất cả các biểu mẫu đều thân thiện với người dùng để hoàn tất và gửi. Nếu ghi đè biểu mẫu mặc định
thì cần nghe và kiểm tra đúng các sự kiện để đặt lại biểu mẫu đúng cách và
bảo vệ chống lại hoạt động đầu vào độc hại của người dùng.
|
Hiệu suất |
Đảm bảo rằng ứng dụng có hiệu quả và phản hồi nhanh, với thời gian tải nhanh. Đây cũng là một phần quan trọng trong quá trình kiểm thử hồi quy.
|
Bạn có thể dùng nhiều công cụ để kiểm tra khả năng hỗ trợ tiếp cận của web. Điều quan trọng là bạn phải sử dụng nhiều phương thức để bao gồm nhiều thành phần hỗ trợ tiếp cận. Hãy nhớ kiểm tra các nhãn ARIA, a11y về các phần tử DOM, thao tác bằng bàn phím và việc sử dụng trình đọc màn hình.
Các khung kiểm thử giao diện người dùng (chẳng hạn như Jest, Vitest, Cypress, Mocha hoặc Jasmine) sẽ giúp bạn viết kiểm thử một cách hiệu quả và hỗ trợ việc phát triển dựa trên hành vi và dựa trên kiểm thử. Khi tích hợp vào quy trình CI/CD, bạn cũng có thể tự động hoá các quy trình kiểm thử và giúp ngăn ngừa lỗi hồi quy trong các cam kết.
Các khung Runner (chẳng hạn như Web Test Runner (Trình chạy kiểm thử web), Playwright, Trình điều khiển web (Web Driver) hoặc Test Runner (Trình chạy kiểm thử) trong Node.js cho phép bạn thực thi các chương trình kiểm thử này một cách hiệu quả cũng như hỗ trợ việc kiểm thử trên nhiều môi trường và nền tảng. Đây không phải là danh sách đầy đủ và tuỳ thuộc vào khung bạn đang sử dụng, có thể có chương trình kiểm thử được tích hợp sẵn.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003eTesting is essential for ensuring the functionality, quality, accessibility, security, and performance of your web application, ultimately enhancing user experience.\u003c/p\u003e\n"],["\u003cp\u003eKey components of web application testing include color contrast, typography, images, navigation, search, forms, and performance.\u003c/p\u003e\n"],["\u003cp\u003eUtilize a variety of accessibility testing tools and methods to cover a comprehensive range of components like ARIA labels, keyboard navigation, and screen reader compatibility.\u003c/p\u003e\n"],["\u003cp\u003eLeverage front-end testing frameworks such as Jest, Vitest, Cypress, Mocha, or Jasmine to efficiently write and automate tests, supporting both behavior-driven and test-driven development.\u003c/p\u003e\n"],["\u003cp\u003eEmploy runner frameworks like Web Test Runner, Playwright, Web Driver, or Node.js's Test Runner for executing tests across multiple environments and platforms.\u003c/p\u003e\n"]]],["Testing should evaluate web application accessibility, functionality, and performance. Key actions include checking color contrast for readability, ensuring relative typography scaling, and verifying image quality and load times. Navigation should be usable via mouse, touch, and keyboard. Search response times should be fast, and forms must be user-friendly with appropriate event handling. Performance, including fast load times, is vital. Multiple tools and front-end frameworks (e.g., Jest, Cypress) can aid in this process, and automation via CI/CD pipelines is recommended.\n"],null,["# Testing a content-driven web app frontend\n\nTesting is crucial to ensuring the functionality, quality, accessibility,\nsecurity, and performance of your content driven web application. Testing lets\nyou assess the user experience and determine if further development is\nnecessary. Your web application should meet quality standards and perform as\nexpected.\n\nThis provides basic testing guidance for you to consider to make your web\napplication accessible and user-friendly.\n\n| Components ||\n|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Color contrast | Ensures that the contrast ratio is optimized for readability. Checks need to be done for various types of color blindness and user defined high contrast forced colors. |\n| Typography | Determines if the application accommodates different devices and settings. By using relative font size and non linear scaling the typography can still be usable on the max size. |\n| Images | Ensures that the images are high quality and can load quickly. It is important to check for correct fallbacks with no network and optimized assets for higher resolutions. |\n| Navigation | Ensures that the navigation is clear and usable by mouse, touch and keyboard navigation. Checking the history api ensures the back and forward navigation is also preserved correctly. |\n| Search | Check for low latency in response times to queries in the URL query parameters and search field. |\n| Form | Ensures that all forms are user-friendly to complete and submit. If overriding the default form submission the correct events need to be listened to and checked for proper form reset and protection against malicious user input. |\n| Performance | Ensures that the application is efficient and responsive, with fast load times. This should be an important part of regression testing too. |\n\nThere are [many tools](https://www.w3.org/WAI/ER/tools/) you can\nuse to check web accessibility. It is important to use multiple methods in order\nto cover the range of accessibility components. Be sure to check for ARIA\nlabels, a11y on DOM elements, keyboard navigation, and screen reader use.\n\nFront end testing frameworks, such as [Jest](https://jestjs.io/),\n[Vitest](https://vitest.dev/),\n[Cypress](https://www.cypress.io/),\n[Mocha](https://mochajs.org/) or\n[Jasmine](https://jasmine.github.io/) help you write tests\nefficiently and support behavior-driven and test-driven development. With\nintegrations into CI/CD pipelines you can also automate your tests and help\nprevent regression bugs in commits.\n\nRunner frameworks, such as [Web Test\nRunner](https://modern-web.dev/docs/test-runner/overview/),\n[Playwright](https://playwright.dev/), [Web\nDriver](https://webdriver.io/) or the [Test Runner in\nNode.js](https://nodejs.org/api/test.html) let you execute these\ntests efficiently and support testing across multiple environments and\nplatforms. This is not an exhaustive list and depending on the framework you are\nusing there could be testing built-in."]]