The Artima Developer Community
Sponsored Link

Agile Buzz Forum
NUnitASP Problems

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Michael

Posts: 1010
Nickname: targetp
Registered: Sep, 2004

Michael is a leader of TargetProcess.com project
NUnitASP Problems Posted: Mar 7, 2005 10:05 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Michael.
Original Post: NUnitASP Problems
Feed Title: TargetProcess Blog
Feed URL: http://feeds2.feedburner.com/Targetprocess
Feed Description: Agile development and processes, project management, programming practices, patterns, XP(eXtreme Programming), SCRUM, Crystal, TargetProcess news, what else?
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Michael
Latest Posts From TargetProcess Blog

Advertisement
I've tried NUnitASP to test ASP.NET web pages in TargetProcess project. As usual, there are some problems with tool adoption. All these issues have been resolved, but I am not satisfied with solutions and stop using NUnitASP for now. I want to find a better way.

Tests Independence & Database State

To keep tests independent, web application should be in known initial state before every test

The TargetProcess system uses database, so the database should be in the same state before each test. I can't find a better way than executing bat file from command line in [SetUp] method. The bat file contains something like this:

osql -U sa -P -d dbname -i D:\TargetProcess\src\Tp.Model\Sql\testData.sql


This works. Not as fast as I want, but I can wait a minute or two. When database become bigger, this solution might be unacteptable.

Dynamic Controls Insertion and NUnitASP

Most of the server controls inserted dynamically on run-time in TargetProcess. This cause additional problems, since controls ids may change. For example, new TargetProcess' module will insert additional control on dashboard. And I should update many already defined Ids in tests. Here is code sample:


protected override void SetUp()
{
SetInnocentState();

control = new UserControlTester("_ctl4", CurrentWebForm);

ddFilterByIteration = new DropDownListTester("ddFilterByIteration", control);
btnUpdate = new ButtonTester("btnUpdate", control);

dgUserStories = new DataGridTester("dgUserStories", control);
row = dgUserStories.GetRow(0);

ddIterations = new DropDownListTester("ddIterations", row);

lbChangeStatus = new LinkButtonTester("lbChangeStatus", row);
lbDelete = new LinkButtonTester("lbDelete", row);

Browser.GetPage("http://tp/Tp.Web/Project/1/Planning/UserStories/List.aspx");
}


[Test]
public void ListView()
{
string[] expected = new string[]
{"Text. Will not check it", "12", "Great"};

AssertEquals(expected[1], dgUserStories.GetRow(0).TrimmedCells[1]);
AssertEquals(expected[2], dgUserStories.GetRow(0).TrimmedCells[2]);
AssertEquals("- Iteration? -", ddIterations.SelectedItem.Text);
AssertEquals("Done", lbChangeStatus.Text);
}

[Test]
public void FilterList()
{
ddFilterByIteration.Items[1].Selected = true;
AssertEquals("Iteration #1", ddIterations.SelectedItem.Text);
ddFilterByIteration.Items[0].Selected = true;
AssertEquals("- Iteration? -", ddIterations.SelectedItem.Text);
}


In code control = new UserControlTester("_ctl4", CurrentWebForm) real base control id is "_ctl4". But when add new control on the top of this, its id will be "_ctl5". This is a major issue for now.

Read: NUnitASP Problems

Topic: How not to impress a blogger Previous Topic   Next Topic Topic: Interesting BattleStar Galactica theme

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use