問題描述
在 VS2010 中創建帶有斷言的編碼 UI 測試的工作流程是什麼? (What is the workflow for creating a coded UI test with assertions in VS2010?)
我正在 VS2010 中創建一個帶有斷言的編碼 UI 測試。這是我想要做的:
- 運行應用程序。
- 測試按鈕上的文本是否為“button1”。
- 單擊
- 測試按鈕上的文字是否“被點擊!”
用編碼的UI測試似乎沒有簡單的方法來做到這一點。特別是,每當我開始錄製然後運行應用程序時,“添加斷言”按鈕都是灰色的。
似乎唯一的方法是分段:首先啟動應用程序,然後關閉編碼的 UI 測試小工具,然後進入測試並右鍵單擊 Generate Code for Coded UI Test,然後使用“添加斷言”
## 參考解法 #### 方法 1:
Automate "launching application from GUI" with Play and record functionality.
(by user128807、NaV)