nunitasp-users Mailing List for NUnitAsp (Page 4)
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: Eddie S. <esh...@ma...> - 2006-06-02 17:54:22
|
Hi, New subscriber, but I was looking at the discussion about master pages in the archive and had the same problem. I have a solution that seems to work. You can use UserControlTesters to "wrap" the master page and the content place holder(s). For example, if you have a master page and a content place holder called "MainContent" then you can use: // Container representing the master page - always ID ctl00 UserControlTester masterPage = new UserControlTester("ctl00", CurrentWebForm); // Container representing the content placeholder UserControlTester mainContent = new UserControlTester("MainContent", masterPage); Then use the masterPage as the container for testing items directly in the master page and the mainContent as the container for testing items in the content place holder. I haven't tried it, but I think you should be able to extend the idea to nested master pages and multiple content place holders. HTH! -- Eddie Sheffield Software Developer * SunGard EXP 1750 Kraft Drive, Suite 2000, Blacksburg, VA 24060 esh...@rr... * 540-961-6500 CONFIDENTIALITY: This email (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited. If you received this email in error, please notify the sender and delete this email from your system. Thank you. |
From: Josh B. <Jo...@hs...> - 2006-05-30 20:43:17
|
Hmm, it looks like it's prepending "ctl00_" to all the controls that are = in the content pages (i.e., not in the master page). ctl00 appears to be = the ID of the master page itself. I can't for the life of me figure out = how to give the master page a meaningful name, like "MasterPage" or = something similarly descriptive... >>> "Owen Evans" <ow...@io...> 05/30/06 10:20AM >>> Before you shout at me for leading you up the wrong path, i'm afraid there is no Tester control, i was just using it as a generic for all the types = of testers... but you should look at the base tags the testers look for, ie if it's a = div you want a paneltester etc etc. Owen On 5/30/06, Josh Beall <Jo...@hs...> wrote: > > Ah. The missing link for me was the "Tester" class. I wasn't aware of > it. I'll check it out. > > >>> "Owen Evans" <ow...@io...> 05/30/06 10:11AM >>> > well essentially you could create the child page as a standard page, and > when you create the individual testers the Id of the component so new > Tester("MasterPage_idOfChildComponent",CurrentWebForm) or something like > that is what i was envisaging. although I'm not sure it will work as = I've > not worked with asp.net 2.0. > > Owen > > On 5/30/06, Josh Beall <Jo...@hs...> wrote: > > > > I know the actual rendered control ID of the controls I want to > test. How > > would I just "fake the id's" like you described? > > > > >>> "Owen Evans" <ow...@io...> 05/29/06 12:30PM >>> > > Sorry to sound ignorant, but any chance you could provide the = different > > id's > > and tags for the master page and child pages, maybe you could mock = them > up > > as inside a standard control or just fake the id's. nunitASP developmen= t > > has > > been very quiet recently i'm not sure how long it's going to survive > > without > > an update (at least to be compatible with the latest nunit) so i'm not > > sure > > how supportive of .net 2.0 it is (not very i would suspect) > > > > Owen > > > > On 5/29/06, Joshua Beall <jb...@he...> wrote: > > > > > > Hi All, > > > > > > I'm using master pages in my webform project, and NUnitAsp can't = seem > to > > > pick up any of the controls that are in my child pages. I assume = this > > is > > > because they're nested inside a ContentPlaceHolder, for which there = is > > no > > > tester (as far as I could tell), and I just tried passing in > > CurrentWebForm > > > as the parent. > > > > > > So, how do I use NUnitAsp with master pages? Not possible? Any > > > alternatives? > > > > > > -Josh > > > > > > > > > |
From: Rob M. <ro...@ne...> - 2006-05-30 16:17:41
|
Right, its use is very limited. Your use of it as a cover is very common and certainly appropriate, IMHO. However, it can be used to isolate and unit-test controller behavior of the code-behind. The tool itself encourages us to get all other behavior out of the code-behind and into something more easily unit-testable. But since we have to have a little bit of controller logic in the code-behind, and good unit-tests are preferable over no tests, this is a good tool for those few tests. =20 There are tricks for doing that. Primarily test-beds in conjunction with mocks. ________________________________ From: nun...@li... [mailto:nun...@li...] On Behalf Of Owen Evans Sent: Tuesday, May 30, 2006 9:08 AM To: nun...@li... Subject: Re: [Nunitasp-users] How to do unit testing with a multipage form? =09 =09 Yeah i wasn't trying to imply taht nunitasp couldn't be used to drive TDD, but it's not very useful as a single tool, and can slow down a CI build to extremes, we use NUnitASP only as integration tests/sanity checks as the GUI is dumb and all actions are just passed to smart classes behind, which then get tested thouroughly with NUnit and mocks, so that they can run in a decent time period for reasonable CI results.=20 =09 Owen =09 =09 On 5/30/06, Rob Myers <ro...@ne...> wrote:=20 Actually, NUnitAsp *is* intended as a unit-testing tool in a TDD environment. It was originally built to unit-test the code-behind object, which is otherwise seemingly impossible to isolate. NUnitAsp is a best-case simulation of code-behind isolation. The tests you write don't meet all of Michael Feathers' criteria for a unit-test, but they can isolate behavior. =20 You do NOT have to step through all possible permutations of your application in order to test it. You can use "test beds" which are test pages that set up state for you (authentication, setting up the Session), and then forwarding to the page to be tested. =20 Rob ________________________________ From: nun...@li... [mailto:nun...@li...] On Behalf Of Owen Evans Sent: Tuesday, May 30, 2006 7:13 AM =09 =09 To: nun...@li... =09 Subject: Fwd: [Nunitasp-users] How to do unit testing with a multipage form? =09 =09 =09 meant to send this to the group. =09 =09 =09 nunit asp is not really a great unit testing tool as such, it is more about integration testing (and ensuring the right components end up on the right pages) the best start i would advice is to get an idea of how to break the appliaction down into it's presentation layer and logic layers, and try and take all logic away from the gui... ie all button presses just call a button press method on a lower object (a dll) which you can then unit test with nunit to simulate button presses.. see the humble dialogue http://c2.com/cgi/wiki?TheHumbleDialogBox . =09 Then try and write all classes to interfaces, as this will alow you to mock up parts of the system at will with a tool such as nmock http://nmock.truemesh.com <http://nmock.truemesh.com/>=20 =09 all in all the aim of the unit test is to test each individual method, so make sure you write modular code. You shouldn't need to have lots of inputs through the GUI if you go down this route as you should know the underlying logic appears, you just need to test the "extras" that asp.net <http://asp.net/> takes care of (data bindings etc) =09 That's my opinion anyway. =09 =09 Owen =09 =09 On 5/29/06, Joshua Beall < jb...@he... <mailto:jb...@he...> > wrote: =09 Hi All, =09 I am new to unit testing, and trying to learn how to do things the "right way". =09 It's my understanding that tests are supposed to be as simple and atomic as possible. It this correct? =09 One of the projects I am working on right now is a 12 page application (a web form). Multiple paths are possible, depending on which how the user answers questions as they progress. =09 I can't figure out how to write a "simple" test for this system. I'd have to simulate a user inputting a substantial amount of data, and I'd have to make sure that there is a test that goes down each path. =09 Is there something I'm missing or not understanding? =09 -Josh =09 =09 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email=20 =09 ______________________________________________________________________ =09 =09 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email=20 =09 ______________________________________________________________________ =09 |
From: Owen E. <ow...@io...> - 2006-05-30 16:08:20
|
Yeah i wasn't trying to imply taht nunitasp couldn't be used to drive TDD, but it's not very useful as a single tool, and can slow down a CI build to extremes, we use NUnitASP only as integration tests/sanity checks as the GUI is dumb and all actions are just passed to smart classes behind, which then get tested thouroughly with NUnit and mocks, so that they can run in a decent time period for reasonable CI results. Owen On 5/30/06, Rob Myers <ro...@ne...> wrote: > > Actually, NUnitAsp *is* intended as a unit-testing tool in a TDD > environment. It was originally built to unit-test the code-behind object, > which is otherwise seemingly impossible to isolate. NUnitAsp is a best-case > simulation of code-behind isolation. The tests you write don't meet all of > Michael Feathers' criteria for a unit-test, but they can isolate behavior. > > You do NOT have to step through all possible permutations of your > application in order to test it. You can use "test beds" which are test > pages that set up state for you (authentication, setting up the Session), > and then forwarding to the page to be tested. > > Rob > > ------------------------------ > *From:* nun...@li... [mailto: > nun...@li...] *On Behalf Of *Owen Evans > *Sent:* Tuesday, May 30, 2006 7:13 AM > > *To:* nun...@li... > *Subject:* Fwd: [Nunitasp-users] How to do unit testing with a multipage > form? > > > meant to send this to the group. > > nunit asp is not really a great unit testing tool as such, it is more > about integration testing (and ensuring the right components end up on the > right pages) the best start i would advice is to get an idea of how to break > the appliaction down into it's presentation layer and logic layers, and try > and take all logic away from the gui... ie all button presses just call a > button press method on a lower object (a dll) which you can then unit test > with nunit to simulate button presses.. see the humble dialogue > http://c2.com/cgi/wiki?TheHumbleDialogBox. > > Then try and write all classes to interfaces, as this will alow you to > mock up parts of the system at will with a tool such as nmock > http://nmock.truemesh.com > > all in all the aim of the unit test is to test each individual method, so > make sure you write modular code. You shouldn't need to have lots of inputs > through the GUI if you go down this route as you should know the underlying > logic appears, you just need to test the "extras" that asp.net takes care > of (data bindings etc) > > That's my opinion anyway. > > Owen > > On 5/29/06, Joshua Beall < jb...@he... > wrote: > > > Hi All, > > > > I am new to unit testing, and trying to learn how to do things the > > "right way". > > > > It's my understanding that tests are supposed to be as simple and atomic > > as possible. It this correct? > > > > One of the projects I am working on right now is a 12 page application > > (a web form). Multiple paths are possible, depending on which how the user > > answers questions as they progress. > > > > I can't figure out how to write a "simple" test for this system. I'd > > have to simulate a user inputting a substantial amount of data, and I'd have > > to make sure that there is a test that goes down each path. > > > > Is there something I'm missing or not understanding? > > > > -Josh > > > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > |
From: Rob M. <ro...@ne...> - 2006-05-30 16:02:15
|
Actually, NUnitAsp *is* intended as a unit-testing tool in a TDD environment. It was originally built to unit-test the code-behind object, which is otherwise seemingly impossible to isolate. NUnitAsp is a best-case simulation of code-behind isolation. The tests you write don't meet all of Michael Feathers' criteria for a unit-test, but they can isolate behavior. =20 You do NOT have to step through all possible permutations of your application in order to test it. You can use "test beds" which are test pages that set up state for you (authentication, setting up the Session), and then forwarding to the page to be tested. =20 Rob ________________________________ From: nun...@li... [mailto:nun...@li...] On Behalf Of Owen Evans Sent: Tuesday, May 30, 2006 7:13 AM To: nun...@li... Subject: Fwd: [Nunitasp-users] How to do unit testing with a multipage form? =09 =09 meant to send this to the group. =09 =09 =09 nunit asp is not really a great unit testing tool as such, it is more about integration testing (and ensuring the right components end up on the right pages) the best start i would advice is to get an idea of how to break the appliaction down into it's presentation layer and logic layers, and try and take all logic away from the gui... ie all button presses just call a button press method on a lower object (a dll) which you can then unit test with nunit to simulate button presses.. see the humble dialogue http://c2.com/cgi/wiki?TheHumbleDialogBox. =09 Then try and write all classes to interfaces, as this will alow you to mock up parts of the system at will with a tool such as nmock http://nmock.truemesh.com <http://nmock.truemesh.com/>=20 =09 all in all the aim of the unit test is to test each individual method, so make sure you write modular code. You shouldn't need to have lots of inputs through the GUI if you go down this route as you should know the underlying logic appears, you just need to test the "extras" that asp.net <http://asp.net/> takes care of (data bindings etc) =09 That's my opinion anyway. =09 =09 Owen =09 =09 On 5/29/06, Joshua Beall < jb...@he... <mailto:jb...@he...> > wrote: =09 Hi All, =09 I am new to unit testing, and trying to learn how to do things the "right way". =09 It's my understanding that tests are supposed to be as simple and atomic as possible. It this correct? =09 One of the projects I am working on right now is a 12 page application (a web form). Multiple paths are possible, depending on which how the user answers questions as they progress. =09 I can't figure out how to write a "simple" test for this system. I'd have to simulate a user inputting a substantial amount of data, and I'd have to make sure that there is a test that goes down each path. =09 Is there something I'm missing or not understanding? =09 -Josh =09 =09 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email=20 =09 ______________________________________________________________________ =09 |
From: Rob M. <ro...@ne...> - 2006-05-30 15:54:58
|
As far as I know, the latest *source* has been decoupled from NUnit altogether, and there is an adapter provided for backward compatibility. =20 Eventually the goal is to release this as NUnitAsp 2.0, but--as you say--development has stalled temporarily. The significant thing that needs to be done at this time is an update to the documentation to put it in synch with the actual changes. =20 Rob ________________________________ From: nun...@li... [mailto:nun...@li...] On Behalf Of Owen Evans Sent: Tuesday, May 30, 2006 7:14 AM To: nun...@li... Subject: Fwd: [Nunitasp-users] Has development stalled? Alternatives to NUnitAsp? =09 =09 And this one =09 =09 =09 NunitASP is already quite seriously out of step with NUnit, and there's been about 6 months since any development was mentioned. =09 I think development on NUnitASP will be dead soon unless someone brings it in line with the latest build of NUnit, and adds missing controls.=20 =09 Not sure what the alternatives are though. =09 =09 =09 =09 =09 On 5/30/06, Joshua Beall < jb...@he...> wrote: =09 Hi All, =09 The word I'm hearing on this list seems to be that development has essentially=20 stalled on NUnitAsp, and that it may only be a matter of time before NUnit has passed it by (and only legacy versions of NUnit will work with NUnitAsp). =09 The sense I'm getting myself, as I'm attempting to use it, is that there are a=20 number of controls that are a part of the systems I'm working on for which there are no NUnitAsp testers. =09 So, I'm wondering if there are alternatives to NUnitAsp? Should I expect any updates to NUnitAsp to be done myself?=20 =09 -Josh =09 =09 ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in=20 the hosting industry. Fanatical Support. Click to learn more =09 http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D= 121642 _______________________________________________ Nunitasp-users mailing list Nun...@li...=20 =09 https://lists.sourceforge.net/lists/listinfo/nunitasp-users =09 =09 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email=20 =09 ______________________________________________________________________ =09 |
From: Owen E. <ow...@io...> - 2006-05-30 14:28:15
|
Before you shout at me for leading you up the wrong path, i'm afraid there is no Tester control, i was just using it as a generic for all the types of testers... but you should look at the base tags the testers look for, ie if it's a div you want a paneltester etc etc. Owen On 5/30/06, Josh Beall <Jo...@hs...> wrote: > > Ah. The missing link for me was the "Tester" class. I wasn't aware of > it. I'll check it out. > > >>> "Owen Evans" <ow...@io...> 05/30/06 10:11AM >>> > well essentially you could create the child page as a standard page, and > when you create the individual testers the Id of the component so new > Tester("MasterPage_idOfChildComponent",CurrentWebForm) or something like > that is what i was envisaging. although I'm not sure it will work as I've > not worked with asp.net 2.0. > > Owen > > On 5/30/06, Josh Beall <Jo...@hs...> wrote: > > > > I know the actual rendered control ID of the controls I want to > test. How > > would I just "fake the id's" like you described? > > > > >>> "Owen Evans" <ow...@io...> 05/29/06 12:30PM >>> > > Sorry to sound ignorant, but any chance you could provide the different > > id's > > and tags for the master page and child pages, maybe you could mock them > up > > as inside a standard control or just fake the id's. nunitASP development > > has > > been very quiet recently i'm not sure how long it's going to survive > > without > > an update (at least to be compatible with the latest nunit) so i'm not > > sure > > how supportive of .net 2.0 it is (not very i would suspect) > > > > Owen > > > > On 5/29/06, Joshua Beall <jb...@he...> wrote: > > > > > > Hi All, > > > > > > I'm using master pages in my webform project, and NUnitAsp can't seem > to > > > pick up any of the controls that are in my child pages. I assume this > > is > > > because they're nested inside a ContentPlaceHolder, for which there is > > no > > > tester (as far as I could tell), and I just tried passing in > > CurrentWebForm > > > as the parent. > > > > > > So, how do I use NUnitAsp with master pages? Not possible? Any > > > alternatives? > > > > > > -Josh > > > > > > > > > |
From: Owen E. <ow...@io...> - 2006-05-30 14:20:17
|
meant to send this to the group. nunit asp is not really a great unit testing tool as such, it is more about integration testing (and ensuring the right components end up on the right pages) the best start i would advice is to get an idea of how to break the appliaction down into it's presentation layer and logic layers, and try and take all logic away from the gui... ie all button presses just call a button press method on a lower object (a dll) which you can then unit test with nunit to simulate button presses.. see the humble dialogue http://c2.com/cgi/wiki?TheHumbleDialogBox. Then try and write all classes to interfaces, as this will alow you to mock up parts of the system at will with a tool such as nmock http://nmock.truemesh.com all in all the aim of the unit test is to test each individual method, so make sure you write modular code. You shouldn't need to have lots of inputs through the GUI if you go down this route as you should know the underlying logic appears, you just need to test the "extras" that asp.net takes care of (data bindings etc) That's my opinion anyway. Owen On 5/29/06, Joshua Beall <jb...@he... > wrote: > Hi All, > > I am new to unit testing, and trying to learn how to do things the "right > way". > > It's my understanding that tests are supposed to be as simple and atomic > as possible. It this correct? > > One of the projects I am working on right now is a 12 page application (a > web form). Multiple paths are possible, depending on which how the user > answers questions as they progress. > > I can't figure out how to write a "simple" test for this system. I'd have > to simulate a user inputting a substantial amount of data, and I'd have to > make sure that there is a test that goes down each path. > > Is there something I'm missing or not understanding? > > -Josh > |
From: Owen E. <ow...@io...> - 2006-05-30 14:14:14
|
And this one NunitASP is already quite seriously out of step with NUnit, and there's been about 6 months since any development was mentioned. I think development on NUnitASP will be dead soon unless someone brings it in line with the latest build of NUnit, and adds missing controls. Not sure what the alternatives are though. On 5/30/06, Joshua Beall < jb...@he...> wrote: > Hi All, > > The word I'm hearing on this list seems to be that development has > essentially > stalled on NUnitAsp, and that it may only be a matter of time before NUnit > has > passed it by (and only legacy versions of NUnit will work with NUnitAsp). > > The sense I'm getting myself, as I'm attempting to use it, is that there > are a > number of controls that are a part of the systems I'm working on for which > there are no NUnitAsp testers. > > So, I'm wondering if there are alternatives to NUnitAsp? Should I expect > any > updates to NUnitAsp to be done myself? > > -Josh > > > ------------------------------------------------------- > All the advantages of Linux Managed Hosting--Without the Cost and Risk! > Fully trained technicians. The highest number of Red Hat certifications in > > the hosting industry. Fanatical Support. Click to learn more > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users > |
From: Owen E. <ow...@io...> - 2006-05-30 14:12:00
|
well essentially you could create the child page as a standard page, and when you create the individual testers the Id of the component so new Tester("MasterPage_idOfChildComponent",CurrentWebForm) or something like that is what i was envisaging. although I'm not sure it will work as I've not worked with asp.net 2.0. Owen On 5/30/06, Josh Beall <Jo...@hs...> wrote: > > I know the actual rendered control ID of the controls I want to test. How > would I just "fake the id's" like you described? > > >>> "Owen Evans" <ow...@io...> 05/29/06 12:30PM >>> > Sorry to sound ignorant, but any chance you could provide the different > id's > and tags for the master page and child pages, maybe you could mock them up > as inside a standard control or just fake the id's. nunitASP development > has > been very quiet recently i'm not sure how long it's going to survive > without > an update (at least to be compatible with the latest nunit) so i'm not > sure > how supportive of .net 2.0 it is (not very i would suspect) > > Owen > > On 5/29/06, Joshua Beall <jb...@he...> wrote: > > > > Hi All, > > > > I'm using master pages in my webform project, and NUnitAsp can't seem to > > pick up any of the controls that are in my child pages. I assume this > is > > because they're nested inside a ContentPlaceHolder, for which there is > no > > tester (as far as I could tell), and I just tried passing in > CurrentWebForm > > as the parent. > > > > So, how do I use NUnitAsp with master pages? Not possible? Any > > alternatives? > > > > -Josh > > > > |
From: Joshua B. <jb...@he...> - 2006-05-30 13:12:49
|
Hi All, The word I'm hearing on this list seems to be that development has essentially stalled on NUnitAsp, and that it may only be a matter of time before NUnit has passed it by (and only legacy versions of NUnit will work with NUnitAsp). The sense I'm getting myself, as I'm attempting to use it, is that there are a number of controls that are a part of the systems I'm working on for which there are no NUnitAsp testers. So, I'm wondering if there are alternatives to NUnitAsp? Should I expect any updates to NUnitAsp to be done myself? -Josh |
From: Chris C. <cc...@cu...> - 2006-05-30 04:28:55
|
Hi Joshua. I think we encounter this struggle with all unit testing =96 the point = when you go from the simple "book" examples to real-world situations. = The sheer bulk and complexity of real business objects can make = otherwise simple tests ridiculously unruly. The short answer is, YES, you have to test all the paths and fill out = all of the form fields. However, I've found a couple of tricks that make it easier. 1) create classes to act as facades for the web form = pages/process-steps. This makes it tremendously easier to repeatedly = fill out each form to varying degrees: Example: [Test] public void CompleteStepOne() { StepOneForm form =3D StepOneForm.CreateInstance(CurrentWebForm); AssertEquals(true,form.WebFormDisplaysProperInitialWidgets()); form.FirstName =3D "Joshua"; form.LastName =3D "Beall"; form.DateOfBirth =3D "4/05/76"; form.Submit.Click(); //Clicking Submit on the first step should take us to the second = step StepTwoForm form2 =3D StepTwoForm.CreateInstance(CurrentWebForm); AssertEquals(true,form2.WebFormDisplaysProperInitialWidgets()); =20 } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 2) create a separate test fixture class for each step and have them all = extend from a common abstract parent class. This allows you to reuse = methods which manipulate your web-form facades and make it faster to = write tests for the latter process steps. 3) Lastly, put all your dynamic labels, copy and error messages in a 3rd = assembly so that you do not have to duplicate the expected text dynamic = content copy in your test fixtures: Example: [Test] public void StepOneRequiresDateOfBirth() { StepOneForm form =3D StepOneForm.CreateInstance(CurrentWebForm); AssertEquals(true,form.WebFormDisplaysProperInitialWidgets()); form.FirstName =3D "Joshua"; form.LastName =3D "Beall"; form.DateOfBirth =3D string.Empty; form.Submit.Click(); //Are we still on the first step? AssertEquals(true,form.WebFormDisplaysProperInitialWidgets()); AssertEquals( LocalizationHelper.Current.StepOne.DOBRequiredMsg, form.ValidationSummary.GetError(0),"Date Of Birth is required = error"); } =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I apologize if my explanation is difficult to understand, but classes = like StepOneForm in my example should not be too hard to imagine if you = are familiar with the Fa=E7ade pattern. Good luck, Chris Chew -----Original Message----- From: nun...@li... on behalf of Joshua = Beall Sent: Mon 5/29/2006 7:42 AM To: nun...@li... Cc:=09 Subject: [Nunitasp-users] How to do unit testing with a multipage form? Hi All, I am new to unit testing, and trying to learn how to do things the=20 "right way". It's my understanding that tests are supposed to be as simple and atomic = as possible. It this correct? One of the projects I am working on right now is a 12 page application=20 (a web form). Multiple paths are possible, depending on which how the=20 user answers questions as they progress. I can't figure out how to write a "simple" test for this system. I'd=20 have to simulate a user inputting a substantial amount of data, and I'd=20 have to make sure that there is a test that goes down each path. Is there something I'm missing or not understanding? -Josh |
From: Joshua B. <jb...@he...> - 2006-05-29 15:09:58
|
Hi All, I'm using master pages in my webform project, and NUnitAsp can't seem to pick up any of the controls that are in my child pages. I assume this is because they're nested inside a ContentPlaceHolder, for which there is no tester (as far as I could tell), and I just tried passing in CurrentWebForm as the parent. So, how do I use NUnitAsp with master pages? Not possible? Any alternatives? -Josh |
From: Joshua B. <jb...@he...> - 2006-05-29 13:43:11
|
Hi All, I am new to unit testing, and trying to learn how to do things the "right way". It's my understanding that tests are supposed to be as simple and atomic as possible. It this correct? One of the projects I am working on right now is a 12 page application (a web form). Multiple paths are possible, depending on which how the user answers questions as they progress. I can't figure out how to write a "simple" test for this system. I'd have to simulate a user inputting a substantial amount of data, and I'd have to make sure that there is a test that goes down each path. Is there something I'm missing or not understanding? -Josh |
From: Jason K. <jk...@sh...> - 2006-04-02 18:29:24
|
I started playing with NUnitAsp yesterday and I found an issue for which I would like some information; maybe some of you have already encountered this. Basically, I run my test cases and they pass. However, at one point I get output similar to the following: Error: ### Error:Element 'style' not allowed inside 'td', closing <td>,<tr>. Referenced on line 57, position 25 of internal entity '#document' Error: ### Error in ##document, line 128, position 10: No matching start tag for '</td>' Error: ### Error in ##document, line 129, position 7: No matching start tag for '</tr>' After playing with this for a while, wondering why it is considering this an error, I realized that if I removed JavaScript from my page, the error went away. Since the JavaScript wasn't used on the page, I just kept on working without putting it back. Now, I wrote another test and I am getting the error pasted above. This time, the page contains typical JavaScript that is automatically generated by ASP.NET 2.0. <script type="text/javascript"> <!-- var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } // --> </script> I am pretty confident that the error doesn't make any sense because all the pages I am testing all use the same master page template and that the reported error is on lines that are inside the common template. Therefore, does anyone have any idea of what is going on? Jason Kealey jk...@sh... http://corp.shade.ca |
From: steve d. <ste...@gm...> - 2006-03-24 02:10:15
|
Hello, I've developed a modification of NUnitAsp that includes a tester for file upload control. I have put the entire source and binaries in a package @ http://www.geocities.com/groovemeister_/NUnitAsp-FileInput.zip. This is an extension of the latest release (1.5.1). The new control is NUnit.Extensions.Asp.HtmlTester.HtmlInputFileTester. There are other modifications too which were necessary to add the file upload capability. The code passes all the unit tests, but beyond that I can't guarantee success. I discussed some of the changes on my blog: http://funkers.blogspot.com/2006/03/nunitasp-upload-file-tester.html Steve |
From: Charles H. <ch...@pe...> - 2006-03-16 09:05:07
|
This happens when I call any click() method on a button. I have used nUnit 2.2.0, then also installed 2.2.7 and got the same problem. nunitasp This is the test code :- ///////////// START CODE // create Login.aspx web control testers TextBoxTester txtUsername = new TextBoxTester( "TBUsername", CurrentWebForm ); TextBoxTester txtPassword = new TextBoxTester( "TBPassword", CurrentWebForm ); ButtonTester btnLoginSubmit = new ButtonTester( "btnLogin", CurrentWebForm ); // browse to login page Browser.GetPage("http://localhost/Login.aspx"); // set text boxes txtUsername.Text = "myUsername"; txtPassword.Text = "myPassword"; Console.WriteLine( "Just about to submit the form..." ); // submit the form btnLoginSubmit.Click(); // <------- EXCEPTION THROWN HERE Console.WriteLine( "Never gets this far... why? " ); // at this point, browser should redirect to a page containing some web controls, datagrid etc. // see if a label on the page is now showing, look for one called LblDateFrom LabelTester lbl = new LabelTester( "LblDateFrom", CurrentWebForm ); AssertVisibility( lbl, true ); /////////// END CODE This is the error that nUnit displays :- System.InvalidOperationException : The specified node cannot be inserted as the valid child of this node, because the specified node is the wrong type. What does this mean? -- Charles Hilditch Programmer ch...@pe... Performance Training, Australia http://www.pertrain.com.au/ |
From: Darius D. <dar...@gm...> - 2006-03-16 06:47:21
|
Sveiki, I am building a gimtadieniu knyga for myself and would be patenkintas for some quick help from you. Just click on the link below and enter your birthday details. It's easy and you can keep your age secret!... Jo, gali b?t secret!! :) http://www.birthdayalarm.com/bd1/12368729a973086607b984040104c174896827d1386 Thanks Darius |
From: Owen E. <ow...@io...> - 2006-03-15 08:34:15
|
Hi all, I'm hoping to find out if there is likely to be any further development on NunitASP as we would like to upgrade to a newer version of Nunit and can't at the moment due to nunitasp dependencies. Is there any likely hood that there will be any further releases? Cheers Owen Evans |
From: Jones, M. <el...@cd...> - 2006-03-13 15:56:16
|
Yes, in that case you should stub out the object or method you are planning to test. Marcie -----Original Message----- From: nun...@li... [mailto:nun...@li...] On Behalf Of Matt Thrower Sent: Monday, March 13, 2006 10:42 AM To: js...@ti... Cc: nun...@li... Subject: Re: [Nunitasp-users] Bypassing page errors Hi, Thanks for the link. Made interesting viewing. Is there any other info available on using testbeds? This is all new stuff to me .. On a related note, I attempted to to some test-driven development on an object the other day and ran into a rather silly problem. The dogma of FDD is test-code-test. However if you try to "test" a method or property of an object when you haven't defined that method or property in code then it's not a question of the test passing or failing - the code won't compile! I presume in this sort of instance you are allowed to do some bare-bones coding first? Cheers, Matt >>> Jim Shore <js...@ti...> 10-Mar-06 1:53:26 am >>> Hi, Matt, You can create a page that sets up your session variables for you and have NUnitAsp call that. We call that a "test bed." Rob Myers is on the list and may have more details for you. You can also see my "Advanced NUnitAsp" video at http://nunitasp.sourceforge.net/AdvancedNUnitAsp.html. Cheers, Jim Matt Thrower wrote: > Hi, >=20 > I've recently discovered NUnit and the concept of unit testing and I=20 > was sold on it's utility straight away. As a web developer I was really > pleased to discover the mightily handy extensions to NUnit provided by > NUnit asp. >=20 > One thing I've tried doing is to go back and build up libraries of unit > tests for old applications that still get regularly updated. I thought > it'd be a good way of getting to grips with NUnit before trying to do > some proper test-driven development on a new application. However, with > the very first application I tried this with I ran into a problem which > looks fairly insurmountable. I'm left wondering as to whether this is > due to bad code design on my part or whether a useful bit of=20 > functionality could be added to NUnit. >=20 > The application in question was for an intranet - I do a lot of=20 > development for intranets. To save users' time on intranets we have an > ActiveX widget that picks up a users windows login ID and picks who they > are out of a database. This is the first step that goes on in a lot of > intranet applications. Once the ID is confirmed then we can pick up a > bunch of useful information - line manager, email, department and so on > and store it in Session variables to use through the application. >=20 > Now here's the crunch - the bulk of the application pages simply won't > work without these Session variables - they error because almost=20 > invariably some of the code is trying to plug one of the session vars > into a database call. This is never normally a problem because the=20 > individual page addresses aren't linked and (because it's an intranet) > can't be found via search engine - users only ever find their way in=20 > through the front page where the session vars are set up. I'd never=20 > normally do this sort of thing on a web site because of the potential > for someone wandering in to a page halfway through the application, but > on the intranet, it's safe. I can't use querystrings because I need the > user ID to be accurate and inviolate. >=20 > Because of this I can't test these apps with NUnit. When I try and run > some tests the page errors and so NUnit gives me the generic http500=20 > error indicating the page isn't working. >=20 > Now AFAIK doing this sort of setting up and then passing round of=20 > session variables isn't all that uncommon in ASP.NET, so this can't be > an uncommon situation to find oneself in. There are a few explanations > as to how I got here and how to move on, namely: > 1) I shouldn't be relying on a front page session var setup - I should > be checking this on every page and setting them up if need be. > 2) I should have better error handling so that when a page encounters a > missing session var it doesn't fall over completely (although how this > helps me with unit testing I'm not sure). > Or ... > 3) This is a fairly common situation and it'd be handy to allow NUnit > ASP to pass in Session variables for use in testing. > Which is right? >=20 > Cheers, > Matt >=20 > A disclaimer applies to all e-mails sent from PPARC Swindon Office.=20 For full text see http://www.pparc.ac.uk/emaildisclaimer.asp=20 > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D= 121642 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore -- Titanium IT -- Successful Software Recipient of 2005 Gordon Pask award for Contributions to Agile Practice phone: 503-267-5490 email: js...@ti... web/blog: http://www.jamesshore.com=20 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D= 121642 _______________________________________________ Nunitasp-users mailing list Nun...@li... https://lists.sourceforge.net/lists/listinfo/nunitasp-users |
From: Matt T. <Mat...@pp...> - 2006-03-13 15:42:33
|
Hi, Thanks for the link. Made interesting viewing. Is there any other info available on using testbeds? This is all new stuff to me .. On a related note, I attempted to to some test-driven development on an object the other day and ran into a rather silly problem. The dogma of FDD is test-code-test. However if you try to "test" a method or property of an object when you haven't defined that method or property in code then it's not a question of the test passing or failing - the code won't compile! I presume in this sort of instance you are allowed to do some bare-bones coding first? Cheers, Matt >>> Jim Shore <js...@ti...> 10-Mar-06 1:53:26 am >>> Hi, Matt, You can create a page that sets up your session variables for you and have NUnitAsp call that. We call that a "test bed." Rob Myers is on the list and may have more details for you. You can also see my "Advanced NUnitAsp" video at http://nunitasp.sourceforge.net/AdvancedNUnitAsp.html. Cheers, Jim Matt Thrower wrote: > Hi, > > I've recently discovered NUnit and the concept of unit testing and I > was sold on it's utility straight away. As a web developer I was really > pleased to discover the mightily handy extensions to NUnit provided by > NUnit asp. > > One thing I've tried doing is to go back and build up libraries of unit > tests for old applications that still get regularly updated. I thought > it'd be a good way of getting to grips with NUnit before trying to do > some proper test-driven development on a new application. However, with > the very first application I tried this with I ran into a problem which > looks fairly insurmountable. I'm left wondering as to whether this is > due to bad code design on my part or whether a useful bit of > functionality could be added to NUnit. > > The application in question was for an intranet - I do a lot of > development for intranets. To save users' time on intranets we have an > ActiveX widget that picks up a users windows login ID and picks who they > are out of a database. This is the first step that goes on in a lot of > intranet applications. Once the ID is confirmed then we can pick up a > bunch of useful information - line manager, email, department and so on > and store it in Session variables to use through the application. > > Now here's the crunch - the bulk of the application pages simply won't > work without these Session variables - they error because almost > invariably some of the code is trying to plug one of the session vars > into a database call. This is never normally a problem because the > individual page addresses aren't linked and (because it's an intranet) > can't be found via search engine - users only ever find their way in > through the front page where the session vars are set up. I'd never > normally do this sort of thing on a web site because of the potential > for someone wandering in to a page halfway through the application, but > on the intranet, it's safe. I can't use querystrings because I need the > user ID to be accurate and inviolate. > > Because of this I can't test these apps with NUnit. When I try and run > some tests the page errors and so NUnit gives me the generic http500 > error indicating the page isn't working. > > Now AFAIK doing this sort of setting up and then passing round of > session variables isn't all that uncommon in ASP.NET, so this can't be > an uncommon situation to find oneself in. There are a few explanations > as to how I got here and how to move on, namely: > 1) I shouldn't be relying on a front page session var setup - I should > be checking this on every page and setting them up if need be. > 2) I should have better error handling so that when a page encounters a > missing session var it doesn't fall over completely (although how this > helps me with unit testing I'm not sure). > Or ... > 3) This is a fairly common situation and it'd be handy to allow NUnit > ASP to pass in Session variables for use in testing. > Which is right? > > Cheers, > Matt > > A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore -- Titanium IT -- Successful Software Recipient of 2005 Gordon Pask award for Contributions to Agile Practice phone: 503-267-5490 email: js...@ti... web/blog: http://www.jamesshore.com ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |
From: Jim S. <js...@ti...> - 2006-03-10 01:53:43
|
Hi, Matt, You can create a page that sets up your session variables for you and have NUnitAsp call that. We call that a "test bed." Rob Myers is on the list and may have more details for you. You can also see my "Advanced NUnitAsp" video at http://nunitasp.sourceforge.net/AdvancedNUnitAsp.html. Cheers, Jim Matt Thrower wrote: > Hi, > > I've recently discovered NUnit and the concept of unit testing and I > was sold on it's utility straight away. As a web developer I was really > pleased to discover the mightily handy extensions to NUnit provided by > NUnit asp. > > One thing I've tried doing is to go back and build up libraries of unit > tests for old applications that still get regularly updated. I thought > it'd be a good way of getting to grips with NUnit before trying to do > some proper test-driven development on a new application. However, with > the very first application I tried this with I ran into a problem which > looks fairly insurmountable. I'm left wondering as to whether this is > due to bad code design on my part or whether a useful bit of > functionality could be added to NUnit. > > The application in question was for an intranet - I do a lot of > development for intranets. To save users' time on intranets we have an > ActiveX widget that picks up a users windows login ID and picks who they > are out of a database. This is the first step that goes on in a lot of > intranet applications. Once the ID is confirmed then we can pick up a > bunch of useful information - line manager, email, department and so on > and store it in Session variables to use through the application. > > Now here's the crunch - the bulk of the application pages simply won't > work without these Session variables - they error because almost > invariably some of the code is trying to plug one of the session vars > into a database call. This is never normally a problem because the > individual page addresses aren't linked and (because it's an intranet) > can't be found via search engine - users only ever find their way in > through the front page where the session vars are set up. I'd never > normally do this sort of thing on a web site because of the potential > for someone wandering in to a page halfway through the application, but > on the intranet, it's safe. I can't use querystrings because I need the > user ID to be accurate and inviolate. > > Because of this I can't test these apps with NUnit. When I try and run > some tests the page errors and so NUnit gives me the generic http500 > error indicating the page isn't working. > > Now AFAIK doing this sort of setting up and then passing round of > session variables isn't all that uncommon in ASP.NET, so this can't be > an uncommon situation to find oneself in. There are a few explanations > as to how I got here and how to move on, namely: > 1) I shouldn't be relying on a front page session var setup - I should > be checking this on every page and setting them up if need be. > 2) I should have better error handling so that when a page encounters a > missing session var it doesn't fall over completely (although how this > helps me with unit testing I'm not sure). > Or ... > 3) This is a fairly common situation and it'd be handy to allow NUnit > ASP to pass in Session variables for use in testing. > Which is right? > > Cheers, > Matt > > A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Nunitasp-users mailing list > Nun...@li... > https://lists.sourceforge.net/lists/listinfo/nunitasp-users -- James Shore -- Titanium IT -- Successful Software Recipient of 2005 Gordon Pask award for Contributions to Agile Practice phone: 503-267-5490 email: js...@ti... web/blog: http://www.jamesshore.com |
From: Jim S. <js...@ti...> - 2006-03-10 01:48:57
|
Strickland,David wrote: > Matt, > We have a similar situation I work with. Testing from my point of > view should not dictate design. Granted this might get a little convoluted > in Test Driven development but a test should not dictate how it is to be > accomplished. TDD is a design technique as much as it is a testing technique. NUnitAsp is meant for TDD, not UI testing. If you using it for ordinary UI testing, you'll be disappointed by its limitations. If you use it for TDD, on the other hand, you'll find it to be a wonderful tool. For UI testing, check out Selenium and Watir. Cheers, Jim -- James Shore -- Titanium IT -- Successful Software Recipient of 2005 Gordon Pask award for Contributions to Agile Practice phone: 503-267-5490 email: js...@ti... web/blog: http://www.jamesshore.com |
From: Strickland,David <dst...@mn...> - 2006-03-09 14:17:22
|
Matt, We have a similar situation I work with. Testing from my point of view should not dictate design. Granted this might get a little convoluted in Test Driven development but a test should not dictate how it is to be accomplished. In short if your current system has a requirement that the user start at Page 1 (to load session vars) and then goes to page 2 (where the vars are used) then your test should do the same thing, going to page 1 (loading the vars) then going to page 2 (testing the use of the vars). Your application has an established dependency that your tests must enforce short circuiting this in any way will decrease the viability and usefulness of your tests. NUnit ASP is a UI test system which would imply you are testing things a user would want to do. As far as I am concerned if every action by a user starts with page 1 and somehow page 1 is deleted every test in the system should fail. IE [NUnit.Framework.Test] public void LoadDataEntryPageTest() { Browser.Credentials = System.Net.CredentialCache.DefaultCredentials; Browser.GetPage("Login.aspx"); ButtonTester LoginButton = new ButtonTester("login", CurrentWebForm); ButtonTester.Click(); //Browser Should now be at default.aspx; Browser.GetPage("DataEntry.Apsx"); //No error test passed } If your looking at adding the requirement that every page on the sight should be navigatable directly without dependency on any prior page then there are several options to accomplish this but as you pointed out this is beyond the scope of testing and goes into design. my 2 pence Dave -----Original Message----- From: nun...@li... [mailto:nun...@li...]On Behalf Of Matt Thrower Sent: Thursday, March 09, 2006 4:05 AM To: nun...@li... Subject: [Nunitasp-users] Bypassing page errors Hi, I've recently discovered NUnit and the concept of unit testing and I was sold on it's utility straight away. As a web developer I was really pleased to discover the mightily handy extensions to NUnit provided by NUnit asp. One thing I've tried doing is to go back and build up libraries of unit tests for old applications that still get regularly updated. I thought it'd be a good way of getting to grips with NUnit before trying to do some proper test-driven development on a new application. However, with the very first application I tried this with I ran into a problem which looks fairly insurmountable. I'm left wondering as to whether this is due to bad code design on my part or whether a useful bit of functionality could be added to NUnit. The application in question was for an intranet - I do a lot of development for intranets. To save users' time on intranets we have an ActiveX widget that picks up a users windows login ID and picks who they are out of a database. This is the first step that goes on in a lot of intranet applications. Once the ID is confirmed then we can pick up a bunch of useful information - line manager, email, department and so on and store it in Session variables to use through the application. Now here's the crunch - the bulk of the application pages simply won't work without these Session variables - they error because almost invariably some of the code is trying to plug one of the session vars into a database call. This is never normally a problem because the individual page addresses aren't linked and (because it's an intranet) can't be found via search engine - users only ever find their way in through the front page where the session vars are set up. I'd never normally do this sort of thing on a web site because of the potential for someone wandering in to a page halfway through the application, but on the intranet, it's safe. I can't use querystrings because I need the user ID to be accurate and inviolate. Because of this I can't test these apps with NUnit. When I try and run some tests the page errors and so NUnit gives me the generic http500 error indicating the page isn't working. Now AFAIK doing this sort of setting up and then passing round of session variables isn't all that uncommon in ASP.NET, so this can't be an uncommon situation to find oneself in. There are a few explanations as to how I got here and how to move on, namely: 1) I shouldn't be relying on a front page session var setup - I should be checking this on every page and setting them up if need be. 2) I should have better error handling so that when a page encounters a missing session var it doesn't fall over completely (although how this helps me with unit testing I'm not sure). Or ... 3) This is a fairly common situation and it'd be handy to allow NUnit ASP to pass in Session variables for use in testing. Which is right? Cheers, Matt A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Nunitasp-users mailing list Nun...@li... https://lists.sourceforge.net/lists/listinfo/nunitasp-users The information contained in this message is confidential, protected from disclosure and may be legally privileged. If the reader of this message is not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any disclosure, distribution, copying, or any action taken or action omitted in reliance on it, is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by replying to this message and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. |
From: Matt T. <Mat...@pp...> - 2006-03-09 10:05:33
|
Hi, I've recently discovered NUnit and the concept of unit testing and I was sold on it's utility straight away. As a web developer I was really pleased to discover the mightily handy extensions to NUnit provided by NUnit asp. One thing I've tried doing is to go back and build up libraries of unit tests for old applications that still get regularly updated. I thought it'd be a good way of getting to grips with NUnit before trying to do some proper test-driven development on a new application. However, with the very first application I tried this with I ran into a problem which looks fairly insurmountable. I'm left wondering as to whether this is due to bad code design on my part or whether a useful bit of functionality could be added to NUnit. The application in question was for an intranet - I do a lot of development for intranets. To save users' time on intranets we have an ActiveX widget that picks up a users windows login ID and picks who they are out of a database. This is the first step that goes on in a lot of intranet applications. Once the ID is confirmed then we can pick up a bunch of useful information - line manager, email, department and so on and store it in Session variables to use through the application. Now here's the crunch - the bulk of the application pages simply won't work without these Session variables - they error because almost invariably some of the code is trying to plug one of the session vars into a database call. This is never normally a problem because the individual page addresses aren't linked and (because it's an intranet) can't be found via search engine - users only ever find their way in through the front page where the session vars are set up. I'd never normally do this sort of thing on a web site because of the potential for someone wandering in to a page halfway through the application, but on the intranet, it's safe. I can't use querystrings because I need the user ID to be accurate and inviolate. Because of this I can't test these apps with NUnit. When I try and run some tests the page errors and so NUnit gives me the generic http500 error indicating the page isn't working. Now AFAIK doing this sort of setting up and then passing round of session variables isn't all that uncommon in ASP.NET, so this can't be an uncommon situation to find oneself in. There are a few explanations as to how I got here and how to move on, namely: 1) I shouldn't be relying on a front page session var setup - I should be checking this on every page and setting them up if need be. 2) I should have better error handling so that when a page encounters a missing session var it doesn't fall over completely (although how this helps me with unit testing I'm not sure). Or ... 3) This is a fairly common situation and it'd be handy to allow NUnit ASP to pass in Session variables for use in testing. Which is right? Cheers, Matt A disclaimer applies to all e-mails sent from PPARC Swindon Office. For full text see http://www.pparc.ac.uk/emaildisclaimer.asp ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ |