Frequently Asked Questions
The NUnitAsp team sees frequently asked questions as indicators of problems with NUnitAsp. We strive to eliminate FAQs by improving NUnitAsp itself, so this isn't the best place to start for general information about NUnitAsp. For an overview, see the NUnitAsp QuickStart Guide. For a detailed tutorial, see the NUnitAsp Tutorial. For installation issues, see the Installation Guide. NUnitAsp is available for download at the NUnitAsp web site.
Q: How do I test if a page has redirected properly?
Q: How do I test user controls and stuff in data grids?
A: See the section titled "User Controls, Data Grids, and Other Control Nesting" in the Quick-Start Guide.
Q: How do I test a site that requires authentication?
A: Use the Credentials property on HttpClient to set your login credentials. For example, to use your current login, you would use this code:
Browser.Credentials = CredentialCache.DefaultCredentials;
You may also include a username and password when you retrieve a URL:
We would like to provide more robust client-side support, but given our limited manpower, we have decided to focus on the code-behind unit-testing aspect of NUnitAsp instead.
Q: But what about AJAX?
If you have server controls that generate client-side AJAX, you can test the server-side component with a custom tester that imitates the client-side behavior. You can't test the client-side behavior with NUnitAsp; NUnitAsp is meant for testing server-side ASPX code-behind.
Q: When I try to compile NUnitAsp in VS.NET, I get a "cryptographic failure" error. What's wrong?
A: The NUnitAsp DLL is strong-named, which means it must be signed by a cryptographic key. If you try to compile without a key, you'll get this error message:
Cryptographic failure while signing assembly 'C:\projects\NUnitAsp\source\NUnitAsp\obj\Debug\NUnitAsp.dll' -- 'The key container name 'NUnitAsp' does not exist'
We don't include a key in the distribution, but the NUnitAsp build script automatically generates the correct kind of key for you. Open a Visual Studio .NET command prompt and type 'nant' in the root NUnitAsp directory to run it. You only need to do this the first time you compile.
Q: When I try to compile NUnitAsp with NAnt, the build says "External program returned errors". What's wrong?
A: The build script is set up to work with .NET 1.0 by default. It sets an environment variable called DotNetToolDir to point to your .NET 1.0 directory. If that directory doesn't exist, the build won't be able to find "sn.exe" and will fail with this error:
[exec] sn -k NUnitAsp.snk
C:\projects\nunitasp\NUnitAsp.build(50,4): External program returned errors, see build log for details.
Try 'nant -help' for more information
To correct this, make sure you've set DotNetToolDir correctly and that sn.exe is in that path.
Once you have that working, NAnt will give you a different error:
[csc] C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\csc.exe failed to start.
The system cannot find the file specified
This error occurs because NAnt uses .NET 1.0 by default. At this point, you can use Visual Studio to build or you can edit NAnt.exe.config in the lib\NAnt directory. If you edit the config file, set the default framework to 1.1:
<platform name="win32" default="net-1.1">
Many thanks to Ted Husted for pointing this out and to Cory Foy for blogging the solution.
Q: How do you spell "NUnitAsp?"
A: "NUnitAsp" is spelled in accordance with .NET framework naming standards. Like .NET's "HttpWebRequest" and "SqlConnection" classes, the first letter of each word is capitalized and acronyms are treated as a single word: N Unit Asp. It's pronounced "en unit a ess pee." It is not spelled "NunitAsp," "NUnitASP," or (heaven forbid) "nUnit.ASP."
Last updated for v2.0.