MVC :: Use The Structure Map Configuration For The Tests?
Sep 12, 2010
On a MVC 3 Preview Web Application I am using the following:
1 - Structure Map for IOC
2 - Fluent Validation for Validation
3 - AutoMapper for mapping.
Everything is working fine.Now I created a Test Project. How can I use the same Structure Map configuration for the tests?
View 5 Replies
Similar Messages:
Oct 21, 2010
In my project we use UnitTests (MsTest). We run them manually and in the build script.But for some environments where we deploy manually.We are in the need of having some smoke tests. At the moment I made this smoke tests "manually" (Login, create an user, create a licence, create a product, etc). I know I can run unit tests from command line or from visual studio but...Do you know if is possible to run these mstests (or probably a small subset) from an .aspx page and show the results?EDITED: wondering if mstests or something is able to run the tests and have something visual to show in an .aspx page similar to a list of tests passed and tests failed...I am thinking on running only a small subset of tests (5-6)
View 1 Replies
Sep 1, 2010
1 .my query is
SELECT a.HD, a.SH, a.TRK, a.TGT, a.TARGET, a.PDC, a.DT_REL, a.STATUS fROM V_HIERARCHY3 a
2. My data is
HR Rec Leave HRL.0001 Policy and Process for leave record. 27.06.2010 30.06.2010 WIP
HR Rec Leave HRL.0002 Quarterly Review 01.07.2010 04.07.2010 Planned
View 1 Replies
Apr 23, 2010
I made a small program which tests a set of url's and checks if they get redirected to another set of urls. Now this program has been working fine till I got a few urls which are of the form [URL] Now the problem occurs when I have a url with "//" not the http://, whenever I use any url with "//" it produces the error The server committed a protocol violation. Section=ResponseStatusLine. If I test the same in the browser it loads the page, but I cannot check the same throught the application. If I remove the "/" then it should work, but then the site wont load.
View 2 Replies
Jul 7, 2010
I have a simple page with a Grid that I'm binding a collection of objects to. I also have some simple functionality on the grid to edit and save rows. I would like to write unit tests for this page, but it's not really making sense to me.For example:
Private Sub LoadGrid()
'Populate Collection
grid.datasource = MyCollection
grid.databind()
end sub
I guess a Sub really doesn't need a unit test, but what if this were a function that returned true when the grid had been loaded. How do you write a unit test for this? What other test should be done on a simple web page like this?
View 2 Replies
Dec 13, 2010
At my previous job we had VS 2008 Team Edition which included the ability to do web tests and load testing right in VS. Currently the company I'm at has VS 2010 Professional but we are thinking of upgrading to Premium, but this still leaves us without the built in Web Testing/Load Testing ability directly in VS.
I'm going to talk to my IT Director and see if they might be willing to go for ultimate, but I need to know first if any off-the-shelf products can fill this hole as the cost is almost double for the Ultimate edition of VS 2010.I really like the testing abilities in 2008 that I worked with, but really just need some of the similar functionality. The ability to record a test and then group a series of tests together, see the HTPP values and results, possibly the ability to do data driven tests and DEFINITELY the need for load testing.
View 2 Replies
Oct 13, 2010
I have Action method in a controller which uses RedirectToAction(actionName, routeValues[])I want to write the unit test for action method to check the following - 1. action name2. ViewData after executing the RedirectToAction.
View 1 Replies
Aug 15, 2010
I need to fake HttpContext.Current.Application table to access it from my unit tests.I need to store my data somewhere. I thought that I can just pass instance of NameValueCollectionBase but as I descover this base type has no indexer so it's too complicated to use. So what about faking this part of HttpContext? Is it possible? How can I make it? Will be NUnit.
View 2 Replies
Mar 31, 2010
I'm developing a website in asp.net webforms with 3 layers; UI, BLL and DAL.The website is already developed, but i like have more control about the unit tests of each form Pass specific values at specific inputs for i see, if application survives or not.
I already study about NUnit but in webforms in UI layer how can apply these tests?What i wnat is get some way to test UI (validations) without have to access to the BLL as i was an user.
I'm trying to add the Unit tests to my app but i not sure how to do it!
View 2 Replies
Mar 16, 2010
As stated in http://forums.asp.net/t/1535916.aspx the unit tests are missing from the ASP.NET MVC 2 RTM source code, but are available on CodePlex at
http://aspnet.codeplex.com/releases/view/41742).
After installing ASP.NET MVC2 RTM on Visual Web Developer 2008 Express, apparently unit tests are not enabled for VWD - when I create a new MVC2 project I don't get the "Create Unit Test Project" dialog box where I can say"Yes, create a unit test project".(I thought I was presented with that dialog box in earlier versions of either MVC2 RC or MVC1, but maybe not...)
Given the source code on codeplex, is it possible to use that to enable unit tests for MVC2 for VWD Express? If so, are the steps one have to take detailed somewhere?
View 5 Replies
Aug 13, 2010
I want to write a unit test which tests the function of a class called UploadedFile. The problem I face is this class' static constructor uses HttpContext.Current property and because I am running my unit test from a class library I do not have an HttpContext at the testing time.
Look at my static constructor:
static UploadedFile()
{
if (HttpContext.Current == null)[code]....
What should I do in my testing environment so that HttpContext.Current won't be null and I can successfully set this:
HttpServerUtility server = HttpContext.Current.Server;
View 2 Replies
Nov 24, 2010
I have written some database integration tests in the format of MS unit test. If I run each test, it runs fine. If I run 2 integration tests, it runs fine. However, if I runs 3 or more test at the same time, one test will show "In Progress", and other shows "Pending", basically, it does not make any progress at all, stays there forever. I turned on SQL Server Profiler, it does not show the test hit the database at all.
Here are some examples of my method:
[Code]....
Here are examples above method integration tests:
[Code]....
View 1 Replies
Sep 8, 2010
But I have other tests that are essentially deployment tests (you can't test how the production deployment went using a unit test on a build server) and I'd like to use the nUnit framework to run these.But, the production server doesn't have the nUnit command line executer. I'm only allowed to run aspx pages and reference .dll's in bin.What do I need to do to run tests (yeah, yeah, they're not really unit tests--relax) using nUnit in a webpage? Is there a straight forward way to do this, or does this essentially require porting the nUnit winforms test runner to ASP.NET?
View 1 Replies
Feb 22, 2011
Fo unit testing ASP.NET controls I need a stubbed Page.
I can create an ASP.NET Page object in my unit tests by subclassing System.Web.UI.Page.However, I cannot find a way to set Page.Form. Adding a form with attribute (runat,server)does not work. Overloading the form in my Subclass does not give the required functionality.
Context:I try to unit test some homemade ASP.NET controls. These control require Page and Page.Form not to be null.
View 3 Replies
May 4, 2010
I need a Continuous integration tool that will support both .Net Unit tests and Javascript unit tests and perform the builds.It looks like my main options are CruiseControl.NET using JUnit and NUnit or Team City and JS Test Driver.
Are there any other options and which ones have you used or had good or bad experiences with.
View 1 Replies
Oct 19, 2010
I have a unit test that reads from an .xml file and it works fine on my local machine.However, in TFS when I create a new build it gives the following exception:
Failed GetArticleByIdTestOptimal Test method Test.ArticleSystemTest.GetArticleByIdTestOptimal threw exception: System.Xml.XmlException: ImportFromFile filePath=[.Articles1to5.xml]. ---> System.IO.FileNotFoundException: Could not find file 'c:uildareaTestResults fservice
2010-10-19 11_52_19_Any CPU_ReleaseOutArticles1to5.xml'..
Is there some reason why a unit test could pass locally but not in TFS? I've verified that the file is on the build server.
View 1 Replies
Mar 17, 2011
I recently came accross the following article on Stephen Walther's website
[URL]
Basically, it provides some excellent guidance on how to integrate your Javascript tests into Visual Studio. I followed the steps in the article and successfully managed to test Javascript methods using Visual Studio tests.
I am unable however to unit test JQuery methods (I get errors such as "window" undefined). I was wondering if anyone has successfully managed to test jQuery methods on the server using the above link?
View 2 Replies
Jun 4, 2010
ASP.Net MVC - How should i do integration testing on an ASP.net MVC application without necessarily running all the tests via the browser?
View 1 Replies
May 28, 2010
I'm just starting to use the TestHelpers in MvcContrib. I want to try and test an action method on my controller that itself tests if IsAjaxRequest() is true. I've used the same code that is shown in the TestHelper samples to set up the TestControllerBuilder
_controller = new StarsController();
_builder = new TestControllerBuilder();
_builder.InitializeController(_controller);
So that _controller has all the faked/mocked HttpContext inside it, which is really great. But what do I do now to force IsAjaxRequest() on the internally faked Request object to return true?
View 2 Replies
Aug 18, 2010
One of my NUnit tests has to read in some values from config files. In my main application this process works perfectly well, however when I run the unit test, the code that reads in the values from the config files doesnt read anything in. Ive tried putting app.config in my unit test project (I even tried web.config) but nothing seems to work. Are there any special steps involved when reading from config files in an nunit test ?
View 1 Replies
Jan 15, 2011
I want to write a few web tests (over WatiN/Selenium + CassiniDev web server) for my asp.net web application.Problem I encountered is that I dont know what to do in such situations: there is a page where user can click the button to call some third-party service. In my web test i want to create mock of this service, which will always return static value (some value in these test case and other value in other test case).How can i do that?
Currently i use IoC/DI container Microsoft Unity. And my pages gets his dependencies in a manner described in http://msdn.microsoft.com/en-us/library/ff664622%28v=pandp.50%29.aspx.
The only solution that comes to my head is: place all dependencies in web.config for each test case and copy necessary web.config on SetUp of test.
View 1 Replies
Jun 16, 2010
We are currently building a site in ASP.net MVC 2 and we have discovered that the URL's we have specified are not supported by MVC. This is what our developers are telling us anyway. I'd like to get feedback form this forum. My asp.net MVC knowledge is limited (I am an old school ASP 3 guy who hasn't programmed for years) but am trying to learn as much as I can so I can understand the limitations. say for example the app is a jobsearch site in the healthcare sector e.g. we would like the urls to be the following:
1. (non advanced searech) [URL]
2. (advanced search) [URL]
they are telling us that they need to send all parameters in the url even if they are blank so our example 1 here would not be possible. It would need to contain all of the possible advanced parameters in the search like this: [URL] most seaerches are basic i.e. looking for job in a location. but users have the optyion to do an advanced search also. The dev is telling us that we must send all params empty in the URL even in a basic search. Has anyone come across this limitation beforee and if so how did you combat it?
View 2 Replies
Jun 15, 2010
What is the best way to implement a rank system:
here is the code i will use
[code]....
View 2 Replies
Oct 27, 2010
i have to build a ASPNET website on which some functionalities will be available to logged in users.I'm trying to understand the right thing to to in building my pages.
I've found the following code in Page_PreInit:
protected void Page_PreInit(object sender, EventArgs e)
{
if (Membership.GetUser() == null) //check the user.. Weather user is logged in or not
{
this.Page.MasterPageFile = "~/General.master";
}
if (Membership.GetUser() == "ADMIN") //check the ADMIN.. Weather ADMIN is logged in or not
{
this.Page.MasterPageFile = "~/ADMIN.master";
}
else
{
this.Page.MasterPageFile = "~/Member.master";
}
}
..but i don't' know if this is the right approach in designing an app.Is it right to switch at runtime Master page according to username/role?
View 1 Replies
Jun 29, 2010
i want to create a forum like page in ASP ,C# where user can enter some question.
Administrator reply this question,according to if user does not satisfied with the solution then in same thread he may ask for further clearance.for example the forum of asp.net ( the current page)
View 5 Replies