2013-05-13 383 views
0

我使用WinForms .Net 2.0 C#應用程序的編碼自動化迴歸測試的TestStack.White框架。在處理確定/取消消息框(MessageBox.Show(...))時,我沒有問題,但在使用MessageBoxButtons.YesNoCancel時無法處理「是/否」按鈕。事情是,我不知道按鈕名稱是什麼。使用MessageBox與MessageBoxButtons.YesNoCancel自動測試

這些工作在我的測試夾具:

public ButtonTestJig OkButton 
    { 
     get { return new ButtonTestJig(Window, "okButton"); } 
    } 

    public ButtonTestJig CancelButton 
    { 
     get { return new ButtonTestJig(Window, "cancelButton"); } 
    } 

有誰知道相當於「cancelButton」爲NO按鈕,相當於「okButton」爲YES按鈕?或者甚至更好,如何找到它們。我的谷歌搜索失敗了。

感謝

+0

爲什麼你需要知道的按鈕名稱?'MessageBoxButtons '進去了,'DialogResult'出來了 – JosephHirn 2013-05-13 12:09:15

+0

避免測試MessageBox,它沒有bug – 2013-05-13 12:58:05

+1

Thx們,我們沒有測試MessageBox,這不是'單元測試'或者組件測試。應用程序迴歸測試。一系列測試來測試按鈕導致事情發生......等等。 – 2013-05-15 05:43:51

回答