Skip to Content
JAVASCRIPT網頁應用程式設計
book

JAVASCRIPT網頁應用程式設計

by Alex MacCaw
January 2013
Intermediate to advanced
332 pages
5h 23m
Chinese
GoTop Information, Inc.
Content preview from JAVASCRIPT網頁應用程式設計
測試與除錯
|
145
你可以自行在
@selenium
物件裡,補上一些判斷式,像是以下這段範例程式碼,就是用
判斷式確認某段特定文字是否有出現在網頁上:
def test_selenium
# ...
assert @selenium.is_text_present("elvis")
end
如果想了解更多關於 Selenium 的資訊,可以觀賞官方網站所提供的教學影片(
http://
seleniumhq.org/movies/intro.mov
)。
在無資訊輸出的環境測試(Headless Testing
隨著伺服器端的 JavaScript 實作(像是 Node.js Rhino)問世,讓我們得以完全不用瀏
覽器、在無資訊輸出的環境(headless environment)、單靠命令列(command line)就
能執行 JavaScript 的測試程式。這種測試方式的好處有二,第一是速度快,第二是較容
易建置測試環境。因為不需考慮各種不同的瀏覽器,也不用準備持續整合伺服器。但這
種測試方式有個缺點,就是測試環境和正式上線後的真實執行環境會有落差。
這個問題看起來似乎很嚴重,但若細想,其實也稱不上什麼大問題。因為其實一般的
JavaScript 程式中,大部分的重點都是和瀏覽器無關的程式邏輯。此外,像 jQuery 這類
的函式庫,已經幫我們處理掉大多數的跨瀏覽器相容性問題(像是 DOM 元件和事件的
管理)。對於一些小型的應用程式而言,只要在正式上線前,先把程式部署到一台模擬
正式環境的伺服器上( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

初めてのJavaScript 第3版 ―ES2015以降の最新ウェブ開発

Ethan Brown, 武舎 広幸, 武舎 るみ
PHP编程:第4版

PHP编程:第4版

Kevin Tatroe, Peter MacIntyre
Strange Code

Strange Code

Ronald T. Kneusel
Perfecting Your Thinking Skills

Perfecting Your Thinking Skills

MIT Sloan Management Review

Publisher Resources

ISBN: 9789862766811