nunitasp-users Mailing List for NUnitAsp
Brought to you by:
jlittle82
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(5) |
Apr
(9) |
May
(8) |
Jun
(7) |
Jul
(17) |
Aug
(14) |
Sep
(18) |
Oct
(14) |
Nov
(14) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(26) |
Feb
(8) |
Mar
(25) |
Apr
(16) |
May
(8) |
Jun
(20) |
Jul
(14) |
Aug
(31) |
Sep
(5) |
Oct
|
Nov
(12) |
Dec
(11) |
2005 |
Jan
(19) |
Feb
(13) |
Mar
(24) |
Apr
(58) |
May
(27) |
Jun
(17) |
Jul
(18) |
Aug
(33) |
Sep
(6) |
Oct
(6) |
Nov
(5) |
Dec
(5) |
2006 |
Jan
(6) |
Feb
(9) |
Mar
(14) |
Apr
(1) |
May
(14) |
Jun
(6) |
Jul
(6) |
Aug
(6) |
Sep
|
Oct
|
Nov
(10) |
Dec
(3) |
2007 |
Jan
(1) |
Feb
(5) |
Mar
(4) |
Apr
|
May
(7) |
Jun
(13) |
Jul
(6) |
Aug
|
Sep
(7) |
Oct
(7) |
Nov
|
Dec
|
From: Steve N. <sne...@pe...> - 2007-10-24 18:27:15
|
Thanks to Erlis and Chris for responding. For the record, I needed to also account for the master page my login contr= ol was in. Here is revised code for the Login() method, if it helps others: private void Login() { Browser.GetPage(Settings.WebSiteLogin); UserControlTester masterPage =3D new UserControlTester("ctl00_C= ontentPlaceHolder1", CurrentWebForm); UserControlTester login =3D new UserControlTester("Login1", mas= terPage); TextBoxTester username =3D new TextBoxTester("UserName", login)= ; TextBoxTester password =3D new TextBoxTester("Password", login)= ; ButtonTester submit =3D new ButtonTester("LoginButton", login); WebAssert.Visible(username); WebAssert.Visible(password); WebAssert.Visible(submit); username.Text =3D Settings.Username; password.Text =3D Settings.Password; submit.Click(); } ________________________________ From: Erlis Vidal [mailto:Ev...@af...] Sent: Wednesday, October 24, 2007 05:41 To: Steve Nesbitt Subject: RE: [Nunitasp-users] NUnitAsp with .Net 2.0 WebControls.Login cont= rol Hi Steve! This is the test case I'm using to test the login page! public void TestLogin() { Browser.GetPage( /*YOUR LOGING PAGE*/ )= ; UserControlTester login =3D new UserCon= trolTester( "Login1", CurrentWebForm ); TextBoxTester txtUserName =3D new TextB= oxTester( "UserName", login ); TextBoxTester txtPassword =3D new TextB= oxTester( "Password", login ); ButtonTester btnLogin =3D new ButtonTes= ter( "LoginButton", login ); AssertVisibility( txtUserName, true ); AssertVisibility( txtPassword, true ); AssertVisibility( btnLogin, true ); txtUserName.Text =3D USER_NAME; txtPassword.Text =3D PASSWORD; btnLogin.Click(); checkIfIsHomePage(); } Hope this can help you! |
From: Wells, C. <Chr...@rs...> - 2007-10-24 11:35:21
|
Hi Steve, =20 View the source of your Web Form in a Browser and make sure that the id's of the login controls match the ids you have used in their declarations in the test. =20 TextBoxTester login =3D new TextBoxTester("UserName", CurrentWebForm);=20 TextBoxTester password =3D new TextBoxTester("Password", CurrentWebForm); ButtonTester submit =3D new ButtonTester("Submit", CurrentWebForm); =20 So the html control where you want the username entered should have id = =3D UserName. If the id is something else then update you test case to use the correct id. =20 Hope that helps =20 Cheers Chris =20 ________________________________ From: nun...@li... [mailto:nun...@li...] On Behalf Of Steve Nesbitt Sent: 24 October 2007 01:40 To: nun...@li... Subject: [Nunitasp-users] NUnitAsp with .Net 2.0 WebControls.Login control Hello, =20 I am trying NUnitAsp for the first time and am struggling to get it to work with my .Net 2.0 web application that uses forms authentication. I have looked over the archives but cannot find a solution that uses the System.Web.UI.WebControls.Login control. I have followed the advice in this blog (http://www.coleblognetwork.com/2007/07/10/using-nunitasp-to-test-pages- wforms-authentication/), and implemented a new WebFormTestCase class as follows: =20 [TestFixture] public class WebFormTestCaseWithAuthentication : WebFormTestCase { protected override void SetUp() { base.SetUp(); if (FormsAuthenticationCookies !=3D null) { Browser.Cookies.Add(FormsAuthenticationCookies); } else { Login(); FormsAuthenticationCookies =3D Browser.Cookies.GetCookies(Browser.CurrentUrl); } } =20 private CookieCollection FormsAuthenticationCookies { get { return (CookieCollection)CallContext.GetData("FormsAuthenticationCookies"); } set { CallContext.SetData("FormsAuthenticationCookies", value); } } =20 private void Login() { Browser.GetPage(Settings.WebSiteLogin); =20 TextBoxTester login =3D new TextBoxTester("UserName", CurrentWebForm); TextBoxTester password =3D new TextBoxTester("Password", CurrentWebForm); ButtonTester submit =3D new ButtonTester("Submit", CurrentWebForm); =20 login.Text =3D Settings.Username; password.Text =3D Settings.Password; submit.Click(); } } =20 When I use this base class in a test method and it attempts to set the Username in the login TextBoxTester in the Login() method, I get the following error: =20 Unexpectedly not visible: UserName (TextBoxTester 'UserName' in web form 'aspnetForm' in http://localhost:5575/Login.aspx) =20 Has anyone got authentication to work with the standard Login web control? Are there other workarounds? =20 All feedback greatly appreciated. =20 Thanks |
From: Steve N. <sne...@pe...> - 2007-10-24 00:39:59
|
Hello, I am trying NUnitAsp for the first time and am struggling to get it to work= with my .Net 2.0 web application that uses forms authentication. I have l= ooked over the archives but cannot find a solution that uses the System.Web= .UI.WebControls.Login control. I have followed the advice in this blog (ht= tp://www.coleblognetwork.com/2007/07/10/using-nunitasp-to-test-pages-wforms= -authentication/), and implemented a new WebFormTestCase class as follows: [TestFixture] public class WebFormTestCaseWithAuthentication : WebFormTestCase { protected override void SetUp() { base.SetUp(); if (FormsAuthenticationCookies !=3D null) { Browser.Cookies.Add(FormsAuthenticationCookies); } else { Login(); FormsAuthenticationCookies =3D Browser.Cookies.GetCookies(B= rowser.CurrentUrl); } } private CookieCollection FormsAuthenticationCookies { get { return (CookieCollection)CallContext.GetData("FormsAuthenti= cationCookies"); } set { CallContext.SetData("FormsAuthenticationCookies", value); } } private void Login() { Browser.GetPage(Settings.WebSiteLogin); TextBoxTester login =3D new TextBoxTester("UserName", CurrentWe= bForm); TextBoxTester password =3D new TextBoxTester("Password", Curren= tWebForm); ButtonTester submit =3D new ButtonTester("Submit", CurrentWebFo= rm); login.Text =3D Settings.Username; password.Text =3D Settings.Password; submit.Click(); } } When I use this base class in a test method and it attempts to set the User= name in the login TextBoxTester in the Login() method, I get the following = error: Unexpectedly not visible: UserName (TextBoxTester 'UserName' in web form 'a= spnetForm' in http://localhost:5575/Login.aspx) Has anyone got authentication to work with the standard Login web control? = Are there other workarounds? All feedback greatly appreciated. Thanks |
From: Jim S. <js...@ja...> - 2007-10-18 05:12:57
|
NUnitAsp runs in a separate process from the web server, so no =20 transaction is possible inside of NUnitAsp. You can write a "staging =20= page" that NUnitAsp visits to start the test which creates and rolls =20 back the transaction. Regards, Jim On Oct 17, 2007, at 6:10 AM, Stjernstr=F6m, Michael wrote: > Hi > Is it possible to run NUnitASP within a transaction and have it =20 > rollback when the test is finished? I have tried using transaction =20 > scope but could not get it to work. One solution to the problem of =20 > resetting the database to a known state is to reinitialize the =20 > database using scripts. There are several tools that will help you =20 > to do this. I would like to mention Liquibase that is a great tool =20 > for developing databases. But I am worried about the performance =20 > issues using this technique. Rolling back a transaction would be a =20 > better solution. > Michael > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a =20 > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/=20 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From:
<Mic...@co...> - 2007-10-17 13:11:35
|
Hi Is it possible to run NUnitASP within a transaction and have it rollback = when the test is finished? I have tried using transaction scope but = could not get it to work. One solution to the problem of resetting the = database to a known state is to reinitialize the database using scripts. = There are several tools that will help you to do this. I would like to = mention Liquibase that is a great tool for developing databases. But I = am worried about the performance issues using this technique. Rolling = back a transaction would be a better solution. Michael |
From: Jim S. <js...@ja...> - 2007-10-04 20:18:13
|
Hi Randar, Sounds like NUnit changed the way it deals with abstract classes--it didn't use to be a problem. I agree, removing [TestFixture] is fine so long as [SetUp] and [TearDown] still work. Cheers, Jim On Oct 4, 2007, at 12:52 PM, Puust, Randar wrote: > I don't believe there is any value in having WebFormTestCase be a > TestFixture. It's a abstract class, so it is not like NUnit can > actually call it, but it looks like an executable test. It just > returns: Reason: NUnit.Extensions.Asp.WebFormTestCase is an > abstract class. > > I added NUnitAdapter.cs to our project, but commented out the > [TestFixture] and it seems to work fine, with the added bonus it > does not show up in the list of tests. > > Randar Puust > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a > browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Puust, R. <Randar.Puust@T4G.com> - 2007-10-04 19:52:55
|
I don't believe there is any value in having WebFormTestCase be a TestFixture. It's a abstract class, so it is not like NUnit can actually call it, but it looks like an executable test. It just returns: Reason: NUnit.Extensions.Asp.WebFormTestCase is an abstract class. =20 I added NUnitAdapter.cs to our project, but commented out the [TestFixture] and it seems to work fine, with the added bonus it does not show up in the list of tests. =20 Randar Puust |
From: Dave H. <da...@dm...> - 2007-09-28 16:35:43
|
Jim, Thanks for the help, I was able to get it to work and I'm successfully testing my website, I'm going to add the vb version of the file to the project tracker. I removed the reference to CompatibilityAdapter. Thanks, Dave _____ From: Jim Shore [mailto:js...@ja...] Sent: Wednesday, September 19, 2007 9:23 PM To: Dave Huesemann Cc: nun...@li... Subject: Re: [Nunitasp-users] VB .Net Hi Dave, I spotted three errors in your conversion: 1- You didn't translate CompatibilityAdapter, yet you're still extending it. Either translate CompatibilityAdapter or remove it here. 2&3- It looks like your definition of the CurrentWebForm and Browser properties are backwards. It should be CurrentWebForm As WebFormTester and you have it the other way around. If you get this to work, please upload it to the Patches tracker on SourceForge. Thanks! Cheers, Jim On Sep 17, 2007, at 11:37 AM, Dave Huesemann wrote: I am having trouble getting NUnitAsp to work. I am using ASP .Net 2.0 with VB. When I placed NUnitAdapter.cs in my project and attempted to compile, the compile failed because I had one item written in C# and all the others in VB. I tried to convert NUnitAdapter.cs to NUnitAdapter.vb, the contents are below, however I am getting the error that the following types are undefined: CompatibilityAdapter, CurrentWebForm and Browser. Is there an additional import statement I need to add? What can I do to resolve the types? Here's the code to NUnitAdapter.vb I created: #Region "Copyright (c) 2002, 2005 by James Shore" '*************************************************************************** ***************************************** ' ' Copyright (c) 2002, 2005 by James Shore ' ' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ' documentation files (the "Software"), to deal in the Software without restriction, including without limitation ' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and ' to permit persons to whom the Software is furnished to do so, subject to the following conditions: ' ' The above copyright notice and this permission notice shall be included in all copies or substantial portions ' of the Software. ' ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ' THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ' DEALINGS IN THE SOFTWARE. ' '*************************************************************************** ***************************************/ #End Region #Region "Instructions" '*************************************************************************** ***************************************** ' ' This file allows NUnitAsp to be used with NUnit. To use, copy this file ' into your test project. For additional information, see the NUnitAsp ' documentation in your download package or visit ' http://nunitasp.sourceforge.net. ' '*************************************************************************** ****************************************/ #End Region Imports NUnit.Framework Imports NUnit.Extensions.Asp.AspTester Imports System.Globalization Imports System.Xml Namespace NUnit.Extensions.Asp ''' <summary> ''' Base class for NUnitAsp test fixtures. Extend this class to use NUnitAsp. ''' </summary> <TestFixture()> _ Public MustInherit Class WebFormTestCase Inherits CompatibilityAdapter 'Make this public class an abstract Private setupCalled As Boolean = False ''' <summary> ''' Do not call. For use by NUnit only. ''' </summary> <SetUp()> _ Public Sub MasterSetUp() setupCalled = True HttpClient.Default = New HttpClient() SetUp() End Sub ''' <summary> ''' Executed before each test method is run. Override in subclasses to do subclass ''' set up. NOTE: The [SetUp] attribute cannot be used in subclasses because it is already ''' in use. ''' </summary> Protected MustOverride Sub SetUp() ''' <summary> ''' Do not call. For use by NUnit only. ''' </summary> <TearDown()> _ Public Sub MasterTearDown() TearDown() End Sub ''' <summary> ''' Executed after each test method is run. Override in subclasses to do subclass ''' clean up. NOTE: [TearDown] attribute cannot be used in subclasses because it is ''' already in use. ''' </summary> Protected MustOverride Sub TearDown() ''' <summary> ''' The web form currently loaded by the browser. ''' </summary> Protected ReadOnly Property WebFormTester() As CurrentWebForm Get AssertSetUp() Return New WebFormTester(HttpClient.Default) End Get End Property ''' <summary> ''' The web browser. ''' </summary> Protected ReadOnly Property HttpClient() As Browser Get AssertSetUp() Return HttpClient.Default End Get End Property Private Sub AssertSetUp() If Not setupCalled Then Throw New ApplicationException("A required setup method in " & _ "WebFormTestCase was not called. " & _ "This is probably because you used the [SetUp] " & _ "attribute in a subclass of WebFormTestCase. " & _ "That is not supported. Override the SetUp() method instead.") End If End Sub End Class End Namespace ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_____________________ __________________________ Nunitasp-users mailing list Nun...@li... https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Jim S. <js...@ja...> - 2007-09-20 02:23:57
|
Hi Dave, I spotted three errors in your conversion: 1- You didn't translate CompatibilityAdapter, yet you're still =20 extending it. Either translate CompatibilityAdapter or remove it here. 2&3- It looks like your definition of the CurrentWebForm and Browser =20 properties are backwards. It should be CurrentWebForm As =20 WebFormTester and you have it the other way around. If you get this to work, please upload it to the Patches tracker on =20 SourceForge. Thanks! Cheers, Jim On Sep 17, 2007, at 11:37 AM, Dave Huesemann wrote: > I am having trouble getting NUnitAsp to work. I am using ASP .Net =20 > 2.0 with VB. When I placed NUnitAdapter.cs in my project and =20 > attempted to compile, the compile failed because I had one item =20 > written in C# and all the others in VB. > > > > I tried to convert NUnitAdapter.cs to NUnitAdapter.vb, the contents =20= > are below, however I am getting the error that the following types =20 > are undefined: CompatibilityAdapter, CurrentWebForm and Browser. > > > > Is there an additional import statement I need to add? What can I =20 > do to resolve the types? > > > > Here=92s the code to NUnitAdapter.vb I created: > > #Region "Copyright (c) 2002, 2005 by James Shore" > > '*********************************************************************=20= > *********************************************** > > ' > > ' Copyright (c) 2002, 2005 by James Shore > > ' > > ' Permission is hereby granted, free of charge, to any person =20 > obtaining a copy of this software and associated > > ' documentation files (the "Software"), to deal in the Software =20 > without restriction, including without limitation > > ' the rights to use, copy, modify, merge, publish, distribute, =20 > sublicense, and/or sell copies of the Software, and > > ' to permit persons to whom the Software is furnished to do so, =20 > subject to the following conditions: > > ' > > ' The above copyright notice and this permission notice shall be =20 > included in all copies or substantial portions > > ' of the Software. > > ' > > ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, =20 > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO > > ' THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR =20 > PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE > > ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR =20 > OTHER LIABILITY, WHETHER IN AN ACTION OF > > ' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN =20 > CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > > ' DEALINGS IN THE SOFTWARE. > > ' > > '*********************************************************************=20= > *********************************************/ > > #End Region > > > > #Region "Instructions" > > '*********************************************************************=20= > *********************************************** > > ' > > ' This file allows NUnitAsp to be used with NUnit. To use, copy =20 > this file > > ' into your test project. For additional information, see the =20 > NUnitAsp > > ' documentation in your download package or visit > > ' http://nunitasp.sourceforge.net. > > ' > > '*********************************************************************=20= > **********************************************/ > > #End Region > > > > Imports NUnit.Framework > > Imports NUnit.Extensions.Asp.AspTester > > Imports System.Globalization > > Imports System.Xml > > > > Namespace NUnit.Extensions.Asp > > > > ''' <summary> > > ''' Base class for NUnitAsp test fixtures. Extend this class =20 > to use NUnitAsp. > > ''' </summary> > > <TestFixture()> _ > > Public MustInherit Class WebFormTestCase > > Inherits CompatibilityAdapter > > > > 'Make this public class an abstract > > Private setupCalled As Boolean =3D False > > > > ''' <summary> > > ''' Do not call. For use by NUnit only. > > ''' </summary> > > <SetUp()> _ > > Public Sub MasterSetUp() > > > > setupCalled =3D True > > HttpClient.Default =3D New HttpClient() > > SetUp() > > > > End Sub > > > > ''' <summary> > > ''' Executed before each test method is run. Override in =20 > subclasses to do subclass > > ''' set up. NOTE: The [SetUp] attribute cannot be used in =20 > subclasses because it is already > > ''' in use. > > ''' </summary> > > Protected MustOverride Sub SetUp() > > > > ''' <summary> > > ''' Do not call. For use by NUnit only. > > ''' </summary> > > <TearDown()> _ > > Public Sub MasterTearDown() > > TearDown() > > End Sub > > > > ''' <summary> > > ''' Executed after each test method is run. Override in =20 > subclasses to do subclass > > ''' clean up. NOTE: [TearDown] attribute cannot be used in =20= > subclasses because it is > > ''' already in use. > > ''' </summary> > > Protected MustOverride Sub TearDown() > > > > ''' <summary> > > ''' The web form currently loaded by the browser. > > ''' </summary> > > Protected ReadOnly Property WebFormTester() As CurrentWebForm > > Get > > AssertSetUp() > > Return New WebFormTester(HttpClient.Default) > > End Get > > End Property > > > > ''' <summary> > > ''' The web browser. > > ''' </summary> > > Protected ReadOnly Property HttpClient() As Browser > > Get > > AssertSetUp() > > Return HttpClient.Default > > End Get > > End Property > > > > Private Sub AssertSetUp() > > If Not setupCalled Then > > Throw New ApplicationException("A required setup =20 > method in " & _ > > "WebFormTestCase was not called. " & _ > > "This is probably because you used the [SetUp] =20 > " & _ > > "attribute in a subclass of WebFormTestCase. " =20= > & _ > > "That is not supported. Override the SetUp() =20 > method instead.") > > End If > > End Sub > > End Class > > End Namespace > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/=20 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Dave H. <da...@dm...> - 2007-09-17 18:37:21
|
I am having trouble getting NUnitAsp to work. I am using ASP .Net 2.0 with VB. When I placed NUnitAdapter.cs in my project and attempted to compile, the compile failed because I had one item written in C# and all the others in VB. I tried to convert NUnitAdapter.cs to NUnitAdapter.vb, the contents are below, however I am getting the error that the following types are undefined: CompatibilityAdapter, CurrentWebForm and Browser. Is there an additional import statement I need to add? What can I do to resolve the types? Here's the code to NUnitAdapter.vb I created: #Region "Copyright (c) 2002, 2005 by James Shore" '*************************************************************************** ***************************************** ' ' Copyright (c) 2002, 2005 by James Shore ' ' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated ' documentation files (the "Software"), to deal in the Software without restriction, including without limitation ' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and ' to permit persons to whom the Software is furnished to do so, subject to the following conditions: ' ' The above copyright notice and this permission notice shall be included in all copies or substantial portions ' of the Software. ' ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ' THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF ' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ' DEALINGS IN THE SOFTWARE. ' '*************************************************************************** ***************************************/ #End Region #Region "Instructions" '*************************************************************************** ***************************************** ' ' This file allows NUnitAsp to be used with NUnit. To use, copy this file ' into your test project. For additional information, see the NUnitAsp ' documentation in your download package or visit ' http://nunitasp.sourceforge.net. ' '*************************************************************************** ****************************************/ #End Region Imports NUnit.Framework Imports NUnit.Extensions.Asp.AspTester Imports System.Globalization Imports System.Xml Namespace NUnit.Extensions.Asp ''' <summary> ''' Base class for NUnitAsp test fixtures. Extend this class to use NUnitAsp. ''' </summary> <TestFixture()> _ Public MustInherit Class WebFormTestCase Inherits CompatibilityAdapter 'Make this public class an abstract Private setupCalled As Boolean = False ''' <summary> ''' Do not call. For use by NUnit only. ''' </summary> <SetUp()> _ Public Sub MasterSetUp() setupCalled = True HttpClient.Default = New HttpClient() SetUp() End Sub ''' <summary> ''' Executed before each test method is run. Override in subclasses to do subclass ''' set up. NOTE: The [SetUp] attribute cannot be used in subclasses because it is already ''' in use. ''' </summary> Protected MustOverride Sub SetUp() ''' <summary> ''' Do not call. For use by NUnit only. ''' </summary> <TearDown()> _ Public Sub MasterTearDown() TearDown() End Sub ''' <summary> ''' Executed after each test method is run. Override in subclasses to do subclass ''' clean up. NOTE: [TearDown] attribute cannot be used in subclasses because it is ''' already in use. ''' </summary> Protected MustOverride Sub TearDown() ''' <summary> ''' The web form currently loaded by the browser. ''' </summary> Protected ReadOnly Property WebFormTester() As CurrentWebForm Get AssertSetUp() Return New WebFormTester(HttpClient.Default) End Get End Property ''' <summary> ''' The web browser. ''' </summary> Protected ReadOnly Property HttpClient() As Browser Get AssertSetUp() Return HttpClient.Default End Get End Property Private Sub AssertSetUp() If Not setupCalled Then Throw New ApplicationException("A required setup method in " & _ "WebFormTestCase was not called. " & _ "This is probably because you used the [SetUp] " & _ "attribute in a subclass of WebFormTestCase. " & _ "That is not supported. Override the SetUp() method instead.") End If End Sub End Class End Namespace |
From: Jim S. <js...@ja...> - 2007-09-14 23:48:16
|
This isn't built-in to NUnitAsp, but so long as the focus is =20 reflected in the static HTML the server sends, you should be able to =20 detect it. You could probably add this support to AspControlTester. Cheers, Jim On Sep 14, 2007, at 11:03 AM, Nathan Southerland wrote: > > > > > From: Nathan Southerland [mailto:nso...@ha...] > Sent: Friday, September 14, 2007 9:01 AM > To: nun...@li... > Subject: Testing Server-dictated Control Focus > > > > Any way to test when a control has its focus set by the server? =20 > I=92ve got a story currently that requires certain fields have the =20 > focus set when conditions are met, and I can=92t seem to find an =20 > obvious solution for testing this in the docs. > > > > Thanks, > > > > > > > > <image001.gif> > > Nathan D. Southerland, MCSD .NET > > Technical Lead, Research & Development > > Hayes Software Systems > > Sales Line: 1-800-749-5086 > > Customer Support: 1-800-495-5993 > > http://www.hayessoft.com > > nso...@ha... > > > > > > <image001.gif> > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/=20 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Aeden J. <aed...@gm...> - 2007-09-04 06:05:55
|
View the html source of Default2.aspx rendered in the browser. Since you're using MasterPages the id of the control you're testing visibility for isn't what you think it is. Hope that helps. Cheers, Aeden On 9/3/07, Kishore Chintoju <kis...@gm...> wrote: > HI > > This is my first day with NUnitASP. I have searched everywhere, but found no > example with this scenario. > > I can't seem make AssertVisibity(TestControl, true) to work when the page > I'm testing is using a Master Page. I'm getting the following exception > > The same code works perfectly fine when the page being tested > (Default2.aspx) does not use a master page. Any help would be really > appreciated. Coz I really couldn't figure out. where I was going wrong. > > Exception > NUnitAspSampleTest.Main.TestDefault2Page : > NUnit.Extensions.Asp.WebAssertionException : Unexpectedly > not visible: txtUsername (TextBoxTester 'txtUsername' in web form > 'aspnetForm' in > http://localhost/NUnitAspSample/Default2.aspx): txtUsername > (TextBoxTester 'txtUsername' in web form 'aspnetForm' in > http://localhost/NUnitAspSample/Default2.aspx) > > Files > > Default2.aspx (Which uses a master page MasterPage.master) > > <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" > AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" > Title="Untitled Page" %> > <asp:Content ID="Content1" > ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> > Sign Up Page:<br /> > <br /> > Username:<br /> > <asp:TextBox ID="txtUsername" > runat="server"></asp:TextBox><br /> > Password:<br /> > <asp:TextBox ID="txtPassword" > runat="server"></asp:TextBox><br /> > Re-Type Password:<br /> > <asp:TextBox ID="txtPasswordReType" > runat="server"></asp:TextBox><br /> > <br /> > <asp:Button ID="btnSignUp" runat="server" Text="Sign Up" /> > <asp:Button ID="btnCancel" runat="server" Text="Button" /> > </asp:Content> > > Main.cs (My Test Fixture) > > using System; > using System.Collections.Generic; > using System.Text; > using NUnit.Framework; > using NUnit.Extensions.Asp; > using NUnit.Extensions.Asp.AspTester; > > namespace NUnitAspSampleTest > { > [TestFixture] > public class Main:WebFormTestCase > { > TextBoxTester txtUsername; > > protected override void SetUp() > { > base.SetUp(); > txtUsername = new > TextBoxTester("txtUsername",CurrentWebForm); > } > > > [Test] > public void TestDefault2Page() > { > Browser.GetPage > ("http://localhost/NUnitAspSample/Default2.aspx"); > AssertVisibility(txtUsername, true); > } > protected override void TearDown() > { > base.TearDown(); > txtUsername = null; > } > > } > } > > > > Cheers > Kishore > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users > > -- Cheers, Aeden |
From: Kishore C. <kis...@gm...> - 2007-09-04 04:25:59
|
HI This is my first day with NUnitASP. I have searched everywhere, but found no example with this scenario. I can't seem make AssertVisibity(TestControl, true) to work when the page I'm testing is using a Master Page. I'm getting the following exception The same code works perfectly fine when the page being tested (Default2.aspx) does not use a master page. Any help would be really appreciated. Coz I really couldn't figure out. where I was going wrong. Exception NUnitAspSampleTest.Main.TestDefault2Page : NUnit.Extensions.Asp.WebAssertionException : Unexpectedly not visible: txtUsername (TextBoxTester 'txtUsername' in web form 'aspnetForm' in http://localhost/NUnitAspSample/Default2.aspx): txtUsername (TextBoxTester 'txtUsername' in web form 'aspnetForm' in http://localhost/NUnitAspSample/Default2.aspx) Files Default2.aspx (Which uses a master page MasterPage.master) <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> Sign Up Page:<br /> <br /> Username:<br /> <asp:TextBox ID="txtUsername" runat="server"></asp:TextBox><br /> Password:<br /> <asp:TextBox ID="txtPassword" runat="server"></asp:TextBox><br /> Re-Type Password:<br /> <asp:TextBox ID="txtPasswordReType" runat="server"></asp:TextBox><br /> <br /> <asp:Button ID="btnSignUp" runat="server" Text="Sign Up" /> <asp:Button ID="btnCancel" runat="server" Text="Button" /> </asp:Content> Main.cs (My Test Fixture) using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using NUnit.Extensions.Asp; using NUnit.Extensions.Asp.AspTester; namespace NUnitAspSampleTest { [TestFixture] public class Main:WebFormTestCase { TextBoxTester txtUsername; protected override void SetUp() { base.SetUp(); txtUsername = new TextBoxTester("txtUsername",CurrentWebForm); } [Test] public void TestDefault2Page() { Browser.GetPage("http://localhost/NUnitAspSample/Default2.aspx "); AssertVisibility(txtUsername, true); } protected override void TearDown() { base.TearDown(); txtUsername = null; } } } Cheers Kishore |
From: Jim S. <js...@ja...> - 2007-07-12 17:18:31
|
Hi Chris, As the error message says, there's something about your DOCTYPE that the NUnitAsp parser is having trouble with. Most likely, the DTD URI is returning a 403 Forbidden error message. You can fix this problem by using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional// EN" >. To see the DOCTYPE, go to the HTML source of your ASP.NET page in Visual Studio. Cheers, Jim On Jul 12, 2007, at 8:21 AM, Chris Prakoso wrote: > Hi all, > > I am a newbie in NUnit(Asp). I was trying to follow the tutorial > that is provided in the Sourceforge's website. > I know it says there that it's not compatible with version 2.0, but > I read the Migration Article and made a few changes for the Tutorial. > > So here is my Test Fixture: > > [TestFixture] > public class GuestBookTest : WebFormTestCase > { > [Test] > public void TestLayout() > { > TextBoxTester name = new TextBoxTester("name"); > TextBoxTester comments = new TextBoxTester("comments"); > ButtonTester save = new ButtonTester("save"); > DataGridTester book = new DataGridTester("book"); > > Browser.GetPage(" http://localhost/GuestBook/ > GuestBook.aspx"); > > WebAssert.Visible (name); > } > } > ==== > > I also have created a website called Guestbook, which I put under > the same solution as the Test. I've also created GuestBook.aspx page. > > But when I ran the Test, I've got the following error: > > TestCase 'GuestBookTests.GuestBookTest.TestLayout' > failed: NUnit.Extensions.Asp.DoctypeDtdException : Problems with > DOCTYPE DTD: <The remote server returned an error: (403) > Forbidden.>. Your DOCTYPE is probably incorrect. If you're not > sure what the DOCTYPE should be, use <!DOCTYPE HTML PUBLIC "-//W3C// > DTD HTML 4.0 Transitional//EN" >, Visual Studio .NET's default. > at NUnit.Extensions.Asp.WebPage.ParsePageText () > at NUnit.Extensions.Asp.WebPage.get_Document() > at NUnit.Extensions.Asp.WebFormTester.FindTagByForm() > at NUnit.Extensions.Asp.WebFormTester.get_Tag() > at NUnit.Extensions.Asp.WebFormTester.get_AspId() > at NUnit.Extensions.Asp.WebFormTester.get_Description () > at NUnit.Extensions.Asp.ControlTester.get_Description() > at NUnit.Extensions.Asp.ControlTester.get_HtmlIdAndDescription() > at NUnit.Extensions.Asp.WebAssert.Visibility(Tester tester, > Boolean expectedVisibility) > at NUnit.Extensions.Asp.WebAssert.Visible (Tester tester) > C:\Projects\GuestBook\GuestBookTests\GuestBookTest.cs(23,0): at > GuestBookTests.GuestBookTest.TestLayout () > > > 0 passed, 1 failed, 0 skipped, took 17.08 seconds. > ====== > > Anybody understand what is happening here ? > I've tried to searched everywhere about this, but it hasn't been > satisfactory. > I'm a bit stuck at the moment. > > Thanks for the help, > Chris > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Chris P. <bra...@gm...> - 2007-07-12 15:21:37
|
Hi all, I am a newbie in NUnit(Asp). I was trying to follow the tutorial that is provided in the Sourceforge's website. I know it says there that it's not compatible with version 2.0, but I read the Migration Article and made a few changes for the Tutorial. So here is my Test Fixture: [TestFixture] public class GuestBookTest : WebFormTestCase { [Test] public void TestLayout() { TextBoxTester name = new TextBoxTester("name"); TextBoxTester comments = new TextBoxTester("comments"); ButtonTester save = new ButtonTester("save"); DataGridTester book = new DataGridTester("book"); Browser.GetPage("http://localhost/GuestBook/GuestBook.aspx"); WebAssert.Visible(name); } } ==== I also have created a website called Guestbook, which I put under the same solution as the Test. I've also created GuestBook.aspx page. But when I ran the Test, I've got the following error: TestCase 'GuestBookTests.GuestBookTest.TestLayout' failed: NUnit.Extensions.Asp.DoctypeDtdException : Problems with DOCTYPE DTD: <The remote server returned an error: (403) Forbidden.>. Your DOCTYPE is probably incorrect. If you're not sure what the DOCTYPE should be, use <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >, Visual Studio .NET's default. at NUnit.Extensions.Asp.WebPage.ParsePageText() at NUnit.Extensions.Asp.WebPage.get_Document() at NUnit.Extensions.Asp.WebFormTester.FindTagByForm() at NUnit.Extensions.Asp.WebFormTester.get_Tag() at NUnit.Extensions.Asp.WebFormTester.get_AspId() at NUnit.Extensions.Asp.WebFormTester.get_Description() at NUnit.Extensions.Asp.ControlTester.get_Description() at NUnit.Extensions.Asp.ControlTester.get_HtmlIdAndDescription() at NUnit.Extensions.Asp.WebAssert.Visibility(Tester tester, Boolean expectedVisibility) at NUnit.Extensions.Asp.WebAssert.Visible(Tester tester) C:\Projects\GuestBook\GuestBookTests\GuestBookTest.cs(23,0): at GuestBookTests.GuestBookTest.TestLayout() 0 passed, 1 failed, 0 skipped, took 17.08 seconds. ====== Anybody understand what is happening here ? I've tried to searched everywhere about this, but it hasn't been satisfactory. I'm a bit stuck at the moment. Thanks for the help, Chris |
From: <mn...@mo...> - 2007-07-10 12:43:34
|
Hi =20 It did the trick, thx again :-) =20 Med venlig hilsen / Regards Mikkel N. Rasmussen Chefudvikler Moment A/S =20 mn...@mo... Gothersgade 11 1123 K=F8benhavn K Tlf.: 70 20 18 35 Fax: 33 11 10 88 =20 www.moment.dk ________________________________ Fra: nun...@li... = [mailto:nun...@li...] P=E5 vegne af = Mikkel N=F8rgaard Rasmussen Sendt: 9. juli 2007 10:34 Til: Jim Shore Cc: nun...@li... Emne: Re: [Nunitasp-users] Multiple selections for ListBoxTesters =20 Thx for the hint. I thought it was because I tried to mark more than one = item as selected. Will try and see what happen :-) =20 Med venlig hilsen / Regards Mikkel N. Rasmussen Chefudvikler Moment A/S =20 mn...@mo... Gothersgade 11 1123 K=F8benhavn K Tlf.: 70 20 18 35 Fax: 33 11 10 88 =20 www.moment.dk ________________________________ Fra: Jim Shore [mailto:js...@ja...]=20 Sendt: 6. juli 2007 22:10 Til: Mikkel N=F8rgaard Rasmussen Cc: nun...@li... Emne: Re: [Nunitasp-users] Multiple selections for ListBoxTesters =20 Hi Mikkel, =20 You're querying the value of SelectedIndex when multiple items are = selected, which isn't supported. As the API documentation says: =20 The test asked a list what item was selected when multiple items were = selected. Modify the test to look at the Selected property of = individual list items, or fix the production code so that only one item = is selected. =20 NUnitAsp 2.0 (available at nunitasp.sf.net) has a more descriptive error = message, as well as numerous other improvements. =20 Cheers, Jim =20 =20 =20 On Jul 6, 2007, at 6:42 AM, Mikkel N=F8rgaard Rasmussen wrote: =20 Hi =20 I have a ListBox that has its selection mode set to multiple. When I in = the test code try to select more than one item in the corresponding = ListBoxTester I get the following exception: TestCase 'Productiontest.ItemListTest.LoadPageTest' failed: = NUnit.Extensions.Asp.AspTester.ListControlTester+MultipleSelectionExcepti= on : Multiple list items are selected. ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedIndex() ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedItem() ved = Productiontest.ItemListTest.SelectItemInListBox(ListBoxTester = listBoxTester, String itemToSelect) i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 225 ved Productiontest.ItemListTest.LoadPageTest() = i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 172 =20 Is this because multiple selections are not supported by the = ListBoxTester or because I miss use the tester? =20 Regards, Mikkel -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_____________________________________= __________ Nunitasp-users mailing list Nun...@li... https://lists.sourceforge.net/lists/listinfo/nunitasp-users =20 -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com =20 =20 =20 =20 |
From: <mn...@mo...> - 2007-07-09 08:34:05
|
Thx for the hint. I thought it was because I tried to mark more than one = item as selected. Will try and see what happen :-) =20 Med venlig hilsen / Regards Mikkel N. Rasmussen Chefudvikler Moment A/S =20 mn...@mo... Gothersgade 11 1123 K=F8benhavn K Tlf.: 70 20 18 35 Fax: 33 11 10 88 =20 www.moment.dk ________________________________ Fra: Jim Shore [mailto:js...@ja...]=20 Sendt: 6. juli 2007 22:10 Til: Mikkel N=F8rgaard Rasmussen Cc: nun...@li... Emne: Re: [Nunitasp-users] Multiple selections for ListBoxTesters =20 Hi Mikkel, =20 You're querying the value of SelectedIndex when multiple items are = selected, which isn't supported. As the API documentation says: =20 The test asked a list what item was selected when multiple items were = selected. Modify the test to look at the Selected property of = individual list items, or fix the production code so that only one item = is selected. =20 NUnitAsp 2.0 (available at nunitasp.sf.net) has a more descriptive error = message, as well as numerous other improvements. =20 Cheers, Jim =20 =20 =20 On Jul 6, 2007, at 6:42 AM, Mikkel N=F8rgaard Rasmussen wrote: Hi =20 I have a ListBox that has its selection mode set to multiple. When I in = the test code try to select more than one item in the corresponding = ListBoxTester I get the following exception: TestCase 'Productiontest.ItemListTest.LoadPageTest' failed: = NUnit.Extensions.Asp.AspTester.ListControlTester+MultipleSelectionExcepti= on : Multiple list items are selected. ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedIndex() ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedItem() ved = Productiontest.ItemListTest.SelectItemInListBox(ListBoxTester = listBoxTester, String itemToSelect) i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 225 ved Productiontest.ItemListTest.LoadPageTest() = i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 172 =20 Is this because multiple selections are not supported by the = ListBoxTester or because I miss use the tester? =20 Regards, Mikkel -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_____________________________________= __________ Nunitasp-users mailing list Nun...@li... https://lists.sourceforge.net/lists/listinfo/nunitasp-users =20 -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com =20 =20 =20 |
From: Jim S. <js...@ja...> - 2007-07-06 20:10:04
|
Hi Mikkel, You're querying the value of SelectedIndex when multiple items are =20 selected, which isn't supported. As the API documentation says: > The test asked a list what item was selected when multiple items =20 > were selected. Modify the test to look at the Selected property of =20= > individual list items, or fix the production code so that only one =20 > item is selected. NUnitAsp 2.0 (available at nunitasp.sf.net) has a more descriptive =20 error message, as well as numerous other improvements. Cheers, Jim On Jul 6, 2007, at 6:42 AM, Mikkel N=F8rgaard Rasmussen wrote: > Hi > > > > I have a ListBox that has its selection mode set to multiple. When =20 > I in the test code try to select more than one item in the =20 > corresponding ListBoxTester I get the following exception: > > TestCase 'Productiontest.ItemListTest.LoadPageTest' > > failed: NUnit.Extensions.Asp.AspTester.ListControlTester=20 > +MultipleSelectionException : Multiple list items are selected. > > ved =20 > NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedIndex() > > ved =20 > NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedItem() > > ved =20 > Productiontest.ItemListTest.SelectItemInListBox(ListBoxTester =20 > listBoxTester, String itemToSelect) i C:\Data\source\TrackEstimates=20 > \Test\productiontest\ViewingListOfItems\ItemListTest.cs:linje 225 > > ved =20 > Productiontest.ItemListTest.LoadPageTest() i C:\Data\source=20 > \TrackEstimates\Test\productiontest\ViewingListOfItems=20 > \ItemListTest.cs:linje 172 > > > > Is this because multiple selections are not supported by the =20 > ListBoxTester or because I miss use the tester? > > > > Regards, > > Mikkel > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/=20 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: <mn...@mo...> - 2007-07-06 13:42:35
|
Hi =20 I have a ListBox that has its selection mode set to multiple. When I in = the test code try to select more than one item in the corresponding = ListBoxTester I get the following exception: TestCase 'Productiontest.ItemListTest.LoadPageTest' failed: = NUnit.Extensions.Asp.AspTester.ListControlTester+MultipleSelectionExcepti= on : Multiple list items are selected. ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedIndex() ved = NUnit.Extensions.Asp.AspTester.ListControlTester.get_SelectedItem() ved = Productiontest.ItemListTest.SelectItemInListBox(ListBoxTester = listBoxTester, String itemToSelect) i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 225 ved Productiontest.ItemListTest.LoadPageTest() = i = C:\Data\source\TrackEstimates\Test\productiontest\ViewingListOfItems\Item= ListTest.cs:linje 172 =20 Is this because multiple selections are not supported by the = ListBoxTester or because I miss use the tester? =20 Regards, Mikkel |
From: Jim S. <js...@ja...> - 2007-06-21 23:25:14
|
Hi Edward, Unfortunately, I can't tell what's going wrong from your email. =20 Maybe somebody else on the list can help troubleshoot. =46rom looking =20= at your code, my best guess is that you don't have the control =20 nesting set up properly. Cheers, Jim On Jun 21, 2007, at 11:17 AM, Mueller, Edward wrote: > Awesome news about NUnitAsp v2.0 being released! I downloaded it =20 > right away. > > > > I=92m having a problem with the CustomValidatorTester. In my case, =20= > I=92m doing client side validation which checks two fields and throws =20= > an error if either one is empty. The validator function looks like =20= > this: > > > > <script language=3D"jscript" > > > function ValidateEmptyHourctl00$middleContent$editIncidentDetailView=20= > $dtCalendarOccured$cvHour1(source, args ) { > > var hourObj =3D document.all.item("ctl00$middleContent=20 > $editIncidentDetailView$dtCalendarOccured$txtHourInput"); > > var minuteObj =3D document.all.item("ctl00$middleContent=20 > $editIncidentDetailView$dtCalendarOccured$txtMinuteInput"); > > > > if ( ((hourObj.value !=3D "" ) && (minuteObj.value =3D=3D =20= > "")) || > > ((hourObj.value =3D=3D "" ) && (minuteObj.value !=3D = "")) ) > > { > > args.IsValid =3D false; > > } > > else > > { > > args.IsValid =3D true; > > }; > > } > > </script> > > > > This works when I browse the page in IE. If I leave either field =20 > blank and hit submit, I get the error message. > > > > The problem is I don=92t get the error when I run a unit test. The =20= > validator is never visible: > > > > private CustomValidatorTester dtCalendarOccured_cvHour1; > > > > dtCalendarOccured =3D new UserControlTester( "dtCalendarOccured", =20= > editIncidentDetailView ); > > dtCalendarOccured_cvHour1 =3D new CustomValidatorTester=20 > ( "cvHour1", dtCalendarOccured ); > > > > [Test] > > public void TestDateOccurredBlankHour() > > { > > txtDateOccurred.Text =3D "1/1/2007"; > > txtHourOccurred.Text =3D ""; > > txtMinuteOccurred.Text =3D "59"; > > btnSend.Click(); > > WebAssert.NotVisible( dtCalendarOccured_cvDate ); > > WebAssert.NotVisible( dtCalendarOccured_rvHour ); > > WebAssert.Visible( dtCalendarOccured_cvHour1 ); =DF PROBLEM > > Assert.AreEqual( ERROR_INVALID_TIME, =20 > dtCalendarOccured_cvHour1.ErrorMessage ); > > WebAssert.NotVisible( dtCalendarOccured_rvMinute ); > > } > > > > The error is: > > > > ApplicationAlertsTests.IncidentDetailTests.TestDateOccurredBlankHour :=20= > NUnit.Extensions.Asp.WebAssertionException : Unexpectedly not =20 > visible: =20 > ctl00_middleContent_editIncidentDetailView_dtCalendarOccured_cvHour1 (=20= > CustomValidatorTester 'cvHour1' in UserControlTester =20 > 'dtCalendarOccured' in UserControlTester 'editIncidentDetailView' =20 > in UserControlTester 'middleContent' in UserControlTester 'ctl00' =20 > in web form 'aspnetForm' in http://localhost/ApplicationAlerts/=20 > AdminTool/Notification/IncidentDetailPage.aspx): =20 > ctl00_middleContent_editIncidentDetailView_dtCalendarOccured_cvHour1 (=20= > CustomValidatorTester 'cvHour1' in UserControlTester =20 > 'dtCalendarOccured' in UserControlTester 'editIncidentDetailView' =20 > in UserControlTester 'middleContent' in UserControlTester 'ctl00' =20 > in web form 'aspnetForm' in http://localhost/ApplicationAlerts/=20 > AdminTool/Notification/IncidentDetailPage.aspx) > > > > Any help would be greatly appreciated. Thanks. > > - Ed. > > > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/=20 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Mueller, E. <Edw...@ps...> - 2007-06-21 18:18:05
|
Awesome news about NUnitAsp v2.0 being released! I downloaded it right away. =20 I'm having a problem with the CustomValidatorTester. In my case, I'm doing client side validation which checks two fields and throws an error if either one is empty. The validator function looks like this: =20 <script language=3D"jscript" > function ValidateEmptyHourctl00$middleContent$editIncidentDetailView$dtCalendarOc cured$cvHour1(source, args ) {=20 var hourObj =3D document.all.item("ctl00$middleContent$editIncidentDetailView$dtCalendar Occured$txtHourInput");=20 var minuteObj =3D document.all.item("ctl00$middleContent$editIncidentDetailView$dtCalendar Occured$txtMinuteInput");=20 =20 if ( ((hourObj.value !=3D "" ) && (minuteObj.value =3D=3D = "")) || ((hourObj.value =3D=3D "" ) && (minuteObj.value !=3D = "")) ) { args.IsValid =3D false; =20 } else=20 { args.IsValid =3D true; }; } </script> =20 This works when I browse the page in IE. If I leave either field blank and hit submit, I get the error message. =20 The problem is I don't get the error when I run a unit test. The validator is never visible: =20 private CustomValidatorTester dtCalendarOccured_cvHour1; =20 dtCalendarOccured =3D new UserControlTester( "dtCalendarOccured", editIncidentDetailView ); dtCalendarOccured_cvHour1 =3D new CustomValidatorTester( "cvHour1", dtCalendarOccured ); =20 [Test] public void TestDateOccurredBlankHour() { txtDateOccurred.Text =3D "1/1/2007"; txtHourOccurred.Text =3D ""; txtMinuteOccurred.Text =3D "59"; btnSend.Click(); WebAssert.NotVisible( dtCalendarOccured_cvDate ); WebAssert.NotVisible( dtCalendarOccured_rvHour ); WebAssert.Visible( dtCalendarOccured_cvHour1 ); <-- PROBLEM Assert.AreEqual( ERROR_INVALID_TIME, dtCalendarOccured_cvHour1.ErrorMessage ); WebAssert.NotVisible( dtCalendarOccured_rvMinute ); } =20 The error is: =20 ApplicationAlertsTests.IncidentDetailTests.TestDateOccurredBlankHour : NUnit.Extensions.Asp.WebAssertionException : Unexpectedly not visible: ctl00_middleContent_editIncidentDetailView_dtCalendarOccured_cvHour1 (CustomValidatorTester 'cvHour1' in UserControlTester 'dtCalendarOccured' in UserControlTester 'editIncidentDetailView' in UserControlTester 'middleContent' in UserControlTester 'ctl00' in web form 'aspnetForm' in http://localhost/ApplicationAlerts/AdminTool/Notification/IncidentDetail Page.aspx): ctl00_middleContent_editIncidentDetailView_dtCalendarOccured_cvHour1 (CustomValidatorTester 'cvHour1' in UserControlTester 'dtCalendarOccured' in UserControlTester 'editIncidentDetailView' in UserControlTester 'middleContent' in UserControlTester 'ctl00' in web form 'aspnetForm' in http://localhost/ApplicationAlerts/AdminTool/Notification/IncidentDetail Page.aspx) =20 Any help would be greatly appreciated. Thanks. - Ed. =20 |
From: Jim S. <js...@ja...> - 2007-06-21 07:41:38
|
I'm happy to announce the release of NUnitAsp v2.0. NUnitAsp is a tool for test-driven development of ASP.NET code-behind. NUnitAsp 2.0 contains a significant set of improvements over 1.5.1. The most important new features are: * Tests ASP.NET 2.0. * Works with any version of any testing framework. * Supports multiple forms. * Tests can directly modify form variables, submit forms, and post-back forms. * Added a boatload of new testers, including a generic tester for any HTML tag. * Supports using XPath to find HTML tags. * Removed need to use CurrentWebForm parameter. * Added Advanced NUnitAsp video. NUnitAsp v2.0 is available for download at: https://sourceforge.net/ project/showfiles.php?group_id=49940. A detailed change log may be found at: http:// nunitasp.sourceforge.net/changes.txt The NUnitAsp website is at http://nunitasp.sourceforge.net. James Shore Project Coordinator NUnitAsp |
From: Jim S. <js...@ja...> - 2007-06-21 02:04:10
|
The NUnitAsp 2.0 beta is poorly named. It doesn't include any of the new code from CVS. It would more properly called "NUnitAsp 1.5.1 for ASP.NET 2.0". Cheers, Jim On Jun 20, 2007, at 7:35 AM, Mueller, Edward wrote: > Hi, > > Please excuse me if this is a dumb question. > > I saw this message dated 5/11/2006: > [NUnitAsp-devl] CVS check-in: validator testers > From: Jim Shore <jshore@ti...> - 2005-11-10 17:06 > Added validator testers: ValidatorTester (generic base class), > CompareValidatorTester, CustomValidatorTester, RangeValidatorTester, > RegularExpressionValidatorTester, RequiredFieldValidatorTester. Also > added HtmlSpanTester. > > I have the NUnitASP 2.0 BETA Release, but I don't see any validator > tester classes. I'm trying to verify the behavior of my validators > client side. I know the LabelTester won't work (visibility is always > 'true'). Is it just not possible to verify client side validators > work > correctly? > > Thanks. > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore, Titanium I.T. LLC voice: 503-267-5490 email: js...@ja... blog: http://www.jamesshore.com |
From: Mueller, E. <Edw...@ps...> - 2007-06-20 15:03:34
|
Hi, Please excuse me if this is a dumb question. I saw this message dated 5/11/2006: [NUnitAsp-devl] CVS check-in: validator testers From: Jim Shore <jshore@ti...> - 2005-11-10 17:06 =20 Added validator testers: ValidatorTester (generic base class),=20 CompareValidatorTester, CustomValidatorTester, RangeValidatorTester,=20 RegularExpressionValidatorTester, RequiredFieldValidatorTester. Also=20 added HtmlSpanTester. I have the NUnitASP 2.0 BETA Release, but I don't see any validator tester classes. I'm trying to verify the behavior of my validators client side. I know the LabelTester won't work (visibility is always 'true'). Is it just not possible to verify client side validators work correctly? Thanks. |
From: Steve W. <ste...@ho...> - 2007-06-18 19:54:11
|
Has anyone else noticed issues with the DropListTester when running with .NET 2.0? I assign it a value via the SelectedValue or SelectedIndex property. I then read it back immediately, but it doesn't return the value I assigned. _________________________________________________________________ Picture this share your photos and you could win big! http://www.GETREALPhotoContest.com?ocid=TXT_TAGHM&loc=us |