MVC :: Run The A WaitN Test?
Aug 17, 2010
I am trying to run WaitN test using NUnit. The test is taken from the book Pro ASP.NET MVC 2 Frameworkby Steven Sanderson and it's located on page 73-74.The test is just testing a default MVC 2 application and it looks like this:
[Code]....
I can run the test in the NUnit GUI, but it fails, I get this error message:IntegrationTestingExample.WaitNTests.UserAccountTests.DisplaysUserNameInPageHeader:System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.This is the stack trace from the NUnit GUI:
at WatiN.Core.IE.CheckThreadApartmentStateIsSTA()
at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess)
at WatiN.Core.IE..ctor()
at IntegrationTestingExample.WaitNTests.UserAccountTests.CreateBrowser() in d:documents and settingsmy documentsvisual studio 2010ProjectsRuneIntegrationTestingExampleIntegrationTestingExample.WaitNTestsUserAccountTests.cs:line 42
at IntegrationTestingExample.WaitNTests.UserAccountTests.DisplaysUserNameInPageHeader() in d:documents and settingsmy documentsvisual studio 2010ProjectsRuneIntegrationTestingExampleIntegrationTestingExample.WaitNTestsUserAccountTests.cs:line 17
WHAT SHALL I DO TO MAKE THE WAITN TEST PASS? AM I DO SOMETHING WRONG? AM I USING THE RIGHT TOOL TO RUN WAITN TESTS?
View 1 Replies
Similar Messages:
May 15, 2010
i have to do some message exchange with a 3rd party (in a website).When the client posts a page, i start the message exchange. When that doesn't succeed for some reason, i report this to the client by rendering the page with a message.On the background, in a separate thread, i start a process to send abort messages to the 3rd party. I can't do this while the user is waiting for the page to come back, because it might take a few minutes.But in a test project, the test ends when the message to the 3rd party is sent, and after the new thread is started. But it seems that the new thread also ends, when the test is done.
Is that normal behaviour?I do start the thread in a new class with a reference to 2 objects from the class which tries to send the message in the first place, may that be a problem?EDIT: it keeps running when the whole process is started in IIS
View 1 Replies
Mar 24, 2010
I am doing Automated coded ui testing in asp.net 2010 for web application. I am testing site and i need to know how can i create the test which will work with all browsers. Right now i created test in IE 8 but its not working in Firefox. So is there any way i can create one test and will work in all browser.
View 2 Replies
Mar 3, 2011
i have datagrid , data coming from database but data in database as formated , i want to show data wihotu format
below example:
<B> test </B> data base has this type data
but in grid i want to show test not with format,
i am getting same data from database.
View 2 Replies
May 5, 2010
i'm a developer with some experience in dotnet 2.0.
i work at the moment with web application and i'd like to find a book or some article about how to test a web application for to know some error that i don't know to do of course :)
is someone knows some good article or book !?
View 6 Replies
Jan 28, 2011
Im trying to write a small web application for forwarding requests to my page to the new pages on my web site. First off im implementing a IHttpHandler and in the ProcessRequest method i simple want to print out the requesting page, my conde looks like this:
public class RedirectHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
[code]...
View 1 Replies
Dec 28, 2010
I'm using the following code to retrieve a value from a SqlDataSource:
[Code]....
The code works fine as long as the variable has a value. But if it's null, then I get errors. How can I test if the value is null?
View 5 Replies
Sep 22, 2010
My question so general, but I think the answer will be specific.
All I want to know is:
Is there a way or steps or mechanism to test the application (web application) in a professional way?
Many times when I finish developing and try my application, testing it with dummy data several times, and when I think every thing is okay and I think I have covered all possible scenarios, I find I forgot important issues, or others tell me they found problems in my application.
How do I overcome this problem, and save my time?
Good links:
[URL]
[URL]
View 7 Replies
Nov 12, 2010
Performance testing best practices for an ap .net application
View 1 Replies
Oct 5, 2010
I have a simple web test. All Web tests concluded in the following method:
[code]....
How can I do this?
MembershipCreateStatus
View 3 Replies
Mar 15, 2011
When I first created the project. Visual studio 2010 gave me an option to create the test project, but I selected "No". Now i want to add teh Test project. Is theor any way, I can add the Test project later.
View 2 Replies
Nov 21, 2010
I'm trying to unit test the MembershipProvider, however I cant figure out how or whether there is any need for unit testing of it...
My business layer:
public interface IAccountService
{
MembershipCreateStatus CreateUser(string userName, string password, string email);
}
public class AccountService : IAccountService
{
private readonly MembershipProvider provider;
public AccountService() : this(null) { }
public AccountService(MembershipProvider providera)
{
this.provider = providera ?? Membership.Provider;
}
public MembershipCreateStatus CreateUser(string userName, string password, string email)
{
if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", userName);
if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", password);
if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", email);
MembershipCreateStatus status;
provider.CreateUser(userName, password, email, null, null, true, null, out status);
return status;
}
}
The only examples I've found so far requires a "MockMembershipProvider" with a local database setup... seems quite odd to me.
View 1 Replies
Jan 9, 2011
I want to test that when my form data is posted back to my controllers that the data annotations and the model binding is going to do its job and give the correct model state. After googling for a while I can't find a really good tutorial or article that shows how to do this.
Can anyone point me in the right direction? What is the best practice in this area? I have read that I may need to use moq and MVCContrib but I have not read a tutorial that makes me shout, "Yes, this is the right way to do it!"
View 1 Replies
May 5, 2010
I've just downloaded NUNit and would like it to be an option for my Test Project provider when I create a new MVC 2 application. At the moment the only option I am getting is the Visual Studio (MSTest) option.
View 2 Replies
Mar 15, 2011
This is my code from my controller:
MGEntities db = new MGEntities();
[HttpPost]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
MembershipCreateStatus createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email);
if (createStatus == MembershipCreateStatus.Success)
{
FormsService.SignIn(model.UserName, false /* createPersistentCookie */);
MembershipUser myObject = Membership.GetUser();
Guid UserID = (Guid)myObject.ProviderUserKey;
MyProfile profile = new MyProfile();
profile.Address = model.Address;
profile.City = model.City;
profile.Zip = model.Zip;
profile.State = model.State;
profile.UserId = UserID;
Debug.Write(profile.State);
db.aspnet_Profiles.Add(profile);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
}
}
This is my MyProfile Class:
namespace MatchGaming.Models
{
[Bind(Exclude = "ProfileId")]
public class MyProfile
{
[Key]
[ScaffoldColumn(false)]
public int ProfileId { get; set; }
public Guid UserId { get; set; }
[DisplayName("Address")]
public string Address { get; set; }
[DisplayName("City")]
public string City { get; set; }
[DisplayName("Zip")]
public string Zip { get; set; }
[DisplayName("State")]
public string State { get; set; }
}
}
After the linq query is executed, i check my database and nothing is added. I am using POCO for my entities. Here is my class:
namespace MatchGaming.Models
{
public class MGEntities : DbContext
{
public DbSet<MyProfile> aspnet_Profiles { get; set; }
}
}
View 2 Replies
May 11, 2010
I'm starting to learning some asp.net so I'm looking for an application to develop asp.net using a mac. I know dreamweaver can be used to write asp.net but I don't have any application to run a test server. ondering what my options are regarding developing and testing (not on a live server) using a mac.
View 2 Replies
May 4, 2010
I'm currently trying to upgrade our build server at work, going from having no build server to having one!
I'm using JetBrains' TeamCity (having used ReSharper for a couple of years I trust their stuff), and intend to use NUnit and MSBuild.
However, I've come up with an issue: it appears that it is not possible to test an ASP.NET web site with NUnit. I had assumed it would be possible to configure it to test App_Code after a build, however it seems that the only way to do tests nicely is through converting the web site to a web application
How could I go about this? the testing needs to be able to be fired automatically from TeamCity.
View 2 Replies
Jan 17, 2011
How do I test if a linkbutton is nothing? I've tried:
if EditEventButton = Nothing then ...
but get the error:
"Operator '=' is not defined for type 'System.Web.UI.WebControls.LinkButton"
View 1 Replies
Nov 23, 2010
finished website,butneed to try it on free hosting that support asp , ajax and sql server..
View 2 Replies
Jan 25, 2011
I need to test how our website will manage a higher volume of traffic.Is there such a thing as traffic simulation software?
View 1 Replies
Mar 1, 2011
Quite simply I want to be able to test that a Asp.Net web forms server control is outputting the correct Html as it will be building dynamic content. I'm just starting to create the control and wanted to do it in a TDD style building up the Html that gets output. I've created a separate class to do the actual Html building so that I am able to test it in isolation outside of the normal Asp.Net pipeline.In my unit tests I can control what html is returned but I'm having problems confirming that the html contains the markup I am expecting for example:
<div id="wrapper">
<div id="fields">
</div>
[code]...
View 3 Replies
Jun 29, 2010
I'm looking for examples or some tutorials that explain how to Unit Test ASP.NET Webforms applications?
Can any one share that?
View 2 Replies
May 4, 2010
We just re-worked about a dozen pages in a website we created - changing the masterpage - adding lots more CSS - changes to images and so on.
The production webserver runs this page using HTTPS:
What do I have to do in IIS to create another "website" that can be accessed? Doesn't the certificate refer to the specific site that's named in that cert?
View 8 Replies
Mar 17, 2011
I am using asp.net and I would like to test a few hundreds concurrent requests to the same page, and get a result. I don't need it via browser. Just a tool that sends requests and prints the result Is there such tool?
View 2 Replies
Jul 14, 2010
I want to use C#/ASP.net to find out whether the user browsing the website is on the same network so that certain links are only displayed while in the office (to those who have access to them).
Anyone accessing from within the office will be doing so by going to it's local IP address (i.e. 192.168.x.x) whereas external users will be browsing to the public domain name.
All I need is some way to differentiate between the two types of user.
View 2 Replies