RE: unit testing when application level scoping used
Howdy, >> Cactus works beautifully with regards to servlet context and general >> environment setup. > > Should I instantiate a bean with session scope that is expected to be >present? Yes, you should instantiate it and place it in the session/application context as needed by your webapp. Another test would be to make sure the webapp doesn't crash if this bean is missing. > Also, how do I handle the fact that I need to log in before I can test >the parts I need to test? That depends on your webapp. You can stuff a username or some other object in the session, or alternatively do actual authentication. This is very specific to how your webapp is written. Again, another test would be how the webapp function when this authentication information is missing. > This whole set up is very difficult to unit test, and that is bothersome, >as I am certain that this is a source of considerable errors in >applications. Yup, sounds like a tough testing environment. But these are common, and that's what tools like Cactus and MockObjects are for. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: unit testing when application level scoping used
> -Original Message- > From: Shapira, Yoav [mailto:[EMAIL PROTECTED] > Sent: Monday, December 22, 2003 10:03 AM > To: Tomcat Users List > Subject: RE: unit testing when application level scoping used > > Cactus works beautifully with regards to servlet context and general > environment setup. Should I instantiate a bean with session scope that is expected to be present? Also, how do I handle the fact that I need to log in before I can test the parts I need to test? This whole set up is very difficult to unit test, and that is bothersome, as I am certain that this is a source of considerable errors in applications. Thank you for your response. " Work like you don't need the money, love like you've never been hurt, and dance like no one is watching." --- Satchel Paige - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: unit testing when application level scoping used
Howdy, > When this is done, will cactus work, or will I need to write my own >jsp page, instantiate the classes needed myself, then run the unit test, >so that everything is set up for it? > > I have never thought of the difficulty of unit testing when using >servlet contexts. It is indeed a difficult subject. MockObjects and/or Cactus can work. I like and use Cactus, even though the cactifyWAR task is slow for large WARs. Note that you need the latest Cactus, v1.5, to test Tomcat 5. Cactus works beautifully with regards to servlet context and general environment setup. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: unit testing when application level scoping used
Shapira, Yoav wrote: You can use MockObjects for this type of thing, assuming that you mean the ServletContext and similar scopes. We are using a commercial application that is buggy. I am trying to test it to see if a new version is better or not than the current version, but I can't test the webapps because the class expects that some classes are already instantiated, as they are set in an application scope by a servlet or jsp page, and there are other classes set in a session scope by other jsp pages. When this is done, will cactus work, or will I need to write my own jsp page, instantiate the classes needed myself, then run the unit test, so that everything is set up for it? I have never thought of the difficulty of unit testing when using servlet contexts. Thank you for your response. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: unit testing when application level scoping used
Howdy, You can use MockObjects for this type of thing, assuming that you mean the ServletContext and similar scopes. Yoav Shapira Millennium ChemInformatics >-Original Message- >From: James Black [mailto:[EMAIL PROTECTED] >Sent: Monday, December 22, 2003 7:11 AM >To: Tomcat Users List >Subject: re: unit testing when application level scoping used > >Hello, > I am trying to write a unit test for an application I didn't write. >There are classes in the classes directory I want to test directly. > > The problem is that the application uses application and session >scoping for some of the classes, so they can reference the instance >without having passed it into the instant I am trying to test. > > I hope this makes sense, I started to understand what was going on >last night. > > How can I unit test a non-jsp page, non servlet page, when scoping is >involved? > > Thank you for any help. > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re: unit testing when application level scoping used
Hello, I am trying to write a unit test for an application I didn't write. There are classes in the classes directory I want to test directly. The problem is that the application uses application and session scoping for some of the classes, so they can reference the instance without having passed it into the instant I am trying to test. I hope this makes sense, I started to understand what was going on last night. How can I unit test a non-jsp page, non servlet page, when scoping is involved? Thank you for any help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]