View Full Version : NUnitAsp compatability
Ted Husted
04-27-2005, 01:59 PM
Has anyone had any luck using NUnitAsp with Spring.Web?
I'm thinking there might be an issue because my pages extend Spring.Web rather than System.Web.
When I try a simple page load, NUnit (via NUnitAsp) throws
WNE.Web.Forms.HomeTest.Load : NUnit.Extensions.Asp.HttpClient+AspServerException : Server threw an exception:
[NullReferenceException]: Object reference not set to an instance of an object.
at Spring.Web.UI.Page.get_UserLocale()
at Spring.Web.UI.Page.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at Spring.Web.Support.PageHandler.ProcessRequest(Http Context context)
at System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)
-Ted.
Aleks Seovic
04-27-2005, 03:57 PM
It looks like either Session or Request variable is null (or both).
It fails when Spring tries to apply localized resources for the page and attempts to get value of the UserLocale from the session:
public virtual CultureInfo UserLocale
{
get
{
if (Session["__userLocale"] == null)
{
Session["__userLocale"] = new CultureInfo(Request.UserLanguages[0]);
}
return (CultureInfo) Session["__userLocale"];
}
set { Session["__userLocale"] = value; }
}
Is there a way to tell NUnitAsp to initialize intrinsic properties? If not, couple strategically places null checks should get the job done, so I'll go ahead and add them to the code.
Thanks,
Aleks
Aleks Seovic
04-27-2005, 04:01 PM
Actually, if I remember correctly, NUnitAsp simply submits the request to the URL, so Session and Request should be there, as well as anything injected by the Spring container (application context, for example).
If that's the case, the only thing that might be null is UserLanguages array. Can you check if that's the case and if it is, if there is a way to specify user language that NUnitAsp Browser class should use for requests.
Thanks,
Aleks
Ted Husted
04-28-2005, 01:19 AM
Thanks, Aleks -- You the man. 8)
I tried this
string[] userLanguages = {"en-us"};
Browser.UserLanguages = userLanguages;
and the page is loading now.
... Now to see if I can manage to write some useful tests :)
-Ted.
Aleks Seovic
04-28-2005, 01:59 AM
Actually, if you get latest code from CVS you don't need to do that. It checks whether Request.UserLanguages is null and if it is defaults UserLocale to CultureInfo.InvariantCulture.
Either way, I'm glad the problem is solved. Good luck with the tests :)
- Aleks
Ted Husted
04-28-2005, 02:14 PM
Cool. So far so good with NUnitAsp.
I poked around, and NUnitAsp seems to be "it" as far as testing ASP.NET pages goes. Is there anything else that people are using instead?
No complaints, just curious.
-Ted.
Aleks Seovic
04-28-2005, 05:14 PM
I think NUnitAsp is "it" for the time being, although I don't like the fact that you can only test the controls that they have built the wrappers for. Ideally, they should generate wrappers on the fly so you can test any control, including the commercial ones.
Another thing I don't like is that the application you are testing needs to be registered with IIS. I'd prefer embedded web server and the ability to register application within test script itself, to avoid issues related to different developers having different configurations.
Correct me if I'm wrong on any of these, I really don't have much experience with it, just gave it a brief look. We'll probably have to build some low level ASP.Net testing infrastructure in order to test Spring.Web. I don't think NUnitAsp will be able to do everything we need, but I might be wrong and would definitely like to hear about your experience with it.
Later,
Aleks
Ted Husted
04-29-2005, 12:53 PM
Jim Shore just posted a note about 1.6, that addresses some of your concerns.
* http://sourceforge.net/mailarchive/forum.php?thread_id=7146358&forum_id=32219
NUnitAsp is under the MIT license,[http://www.opensource.org/licenses/mit-license.php], which is compatible with the Apache License.
I'm still liking it after the first day. Ran into a snag with my DataGrids, though, apparently because I'm not using template columns. I'm going switch over to the CVS version later today before posting to the list.
-Ted.
vravikumarv
01-25-2007, 01:20 PM
problems with NUnitAsp:
Navigation Testing
how to Test navigation using NUnitAsp.
where should i maintain Test Cases for individual Tire.how to implement Test Cases in NUnitAsp for 3 tire Architecture.
where should i maintain test cases.
if any body femilier with NUnitAsp in 3 tire Architecture Product,help me.
QUOTE=Ted Husted;422]Has anyone had any luck using NUnitAsp with Spring.Web?
I'm thinking there might be an issue because my pages extend Spring.Web rather than System.Web.
When I try a simple page load, NUnit (via NUnitAsp) throws
WNE.Web.Forms.HomeTest.Load : NUnit.Extensions.Asp.HttpClient+AspServerException : Server threw an exception:
[NullReferenceException]: Object reference not set to an instance of an object.
at Spring.Web.UI.Page.get_UserLocale()
at Spring.Web.UI.Page.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at Spring.Web.Support.PageHandler.ProcessRequest(Http Context context)
at System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)
-Ted.[/QUOTE]
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.