The first NUNITASP test program written is to look at the help. Place a TextBox and Button on WebForm, the test class is as follows: Add a reference to NUnitasp.dll to the project, then reference the namespace: use nunit.framework; using nunit.extensions.asp.asptester;
[TestFixTure]???
public
?
Class
? xxx?: NUNIT.EXTENSIONS.ASP.WEBFORMTESTCASE ????
{???????? const? string? mypage? =? @ "http://localhost/webapplication6/webform1.aspx"; ???????? Buttontester? bt; ?????? ?? TEXTBOXTESTER? Text; ???????? protected? Override? Void? Setup () ???????? {???????????? Browser.getPage (MyPage) ; ???????????? bt? =? new? ButtonTester ("Button1", currentwebform); ???????????? text? =? new? TextBoxTester ("TextBox1 ", Currentwebform); ????????} ???????? protected? Override? Void? Teardown () ???????? {????????}? ???????????????? [test] ???????? public? Void? TestButton () ???????? {???????? ???? nunit.extensions.asp.webassertion.assertvisibility (bt?, True); ????????} ???????? public? Void? TestText1 () ?????? ?? {???????????? text.text? =? "aaa"; ???????????? bt.click (); ??????? ????? NUnit.extensions.asp.webassertion.assertequals (text.text?, "Aaa"); ????????} ????}
Open the NUnit run test, open the assembly, and run the test. Looking at the green progress bar, it feels good
However, I feel that there is more things on the interface, and I am afraid I still have a bit trouble.
Just started learning, please advise you