傳統上,使用者與網頁應用程式(Web Applications)互動必須透過超連結對網頁伺服器送出請求,藉此執行伺服器端的程式進行商業邏輯的運算,產生新的網頁回傳至客戶端瀏覽器給使用者,故其測試案例通常是由一連串頁面的瀏覽路徑組成。最近幾年一種稱為AJAX的網頁程式技術漸漸開始流行並且迅速的發展;使用AJAX技術的網頁應用程式透過執行網頁中的腳本語言,能發出非同步請求與伺服器溝通,並存取網頁文件的文件物件模型(Document Object Model, DOM)以動態改變網頁的部份內容,而不需重新自伺服器端載入整個網頁,可減少頻寬的使用與下載的時間。由於頁面瀏覽的概念在AJAX網頁應用程式中逐漸式微,使得測試傳統網頁應用程式瀏覽行為的方法並不足以有效驗證AJAX網頁程式。 有鑑於此,本論文提出一個AJAX網頁應用程式的測試模型:AWASD (AJAX Web Application State Diagram)。AWASD測試模型是一個階層式並行狀態機(Hierarchical and Concurrent State Machine),主要包含三個階層:(1)屬性狀態圖;(2)DOM狀態圖;和(3)連結狀態圖,分別針對個別HTML屬性的狀態、單一網頁內DOM的狀態及整個網頁應用程式的狀態行為進行塑模,以萃取AJAX網頁應用程式的客戶端的瀏覽行為。此階層式模型不但有助於測試人員了解和分析網頁之內(intra-page)和網頁之間(inter-page)的瀏覽行為,並可透過此模型推導測試序列,協助AJAX網頁應用程式的測試。本論文並實作一套測試輔助工具,此工具能協助AWASD測試模型的建構,並可系統化產生測試序列來驗證AJAX網頁程式的行為,以提升AJAX網頁應用程式的品質。
Traditionally users interact with a web application by submiting a request to web sever through a hyperlink. The request is then handled by server-side program to execute the business logic of the web application and to generate a new web page as the response to the request. Test cases for such web application can be sequences of web pages that exercise different navigation paths of the web application. In recent years, a technology called AJAX(Asynchronous JavaScript and XML) has grown rapidly and become popular. It enables web applications to send requests to web server asynchronously with Javascript. AJAX then uses the response data in the background to update the contents of web page dynamically via manipulating its DOM(Document Object Model) without reloading the whole page, thus reducing the bandwidth usage and load time. As a result, navigation in AJAX web applications may not necessarily be sequences of web pages as that in tradtional web applications and, hence, existing testing methods can be insufficient or ineffective for AJAX web applications. In view of the situation, this thesis proproses a testing model called AWASD (AJAX Web Application State Diagram) to abstract the navigation behavior of AJAX web applications. Specifically, the AWASD is a hierarchical and concurrent state machine consisting of three levels: (1)Attribute State Diagram; (2)DOM State Diagram; and (3)Link State Diagram that capture the state behavior of an attribute for a HTML element, a DOM for a web page, and an AJAX web application, respectively. The proposed test model not only can help testers understanding and anlayzing the possible intra-page and inter-page navigation behavior, bust also can be used to derive test sequences to verify the navigation behavior of AJAX web applications. In addition, to facilitate the testing of AJAX web applications, a tool is implemented to support the construction of AWASD and to generate test sequences systematically for verifying the navigation behavior of AJAX web applications so as to improve their quality.