visual studio team suite : How to web test programmatically? - asp.net

Good day,
I'm new to Visual Studio 2005 Team Suite web testing. Here's the action i'm trying to achieve.
On a webpage, I have a dropdownlist that is populated from a simple database table. In my tests, I want to click on each items of the dynamically populated dropdownlist, and after the postback, check if a label is visible on the page, which depends of the selected item in the dropdownlist.
However, since the dropdownlist is dynamically generated, I cannot simply 'record' and manually click on each item of the dropdownlist, so I have to code the test.
I'm pretty sure this is really simple to achieve, so I was wondering if there is a good free tutorial on web testing that I could use.
Thank you very much!

You question.
However, since the dropdownlist is
dynamically generated, I cannot simply
'record' and manually click on each
item of the dropdownlist, so I have to
code the test.
It seems to me that you need add "Data Binding" to your test.
Please read through this MSDN article.
HTH.

As long as it is fairly standard web-form postbacks you can use NUnitAsp:
http://nunitasp.sourceforge.net/
Here is a decent article on it here:
ServerSide NUnitASP
NUnitAsp is no longer really active or supported, but it still works good enough for simple form testing.

Related

How to implement custom paging in ASP.NET Gridview that has Command Buttons in VB.NET

I am currently trying to implement a gridview with custom paging. I've gotten this to work by following the tutorial on ASP Snippets, located here:
http://www.aspsnippets.com/Articles/ASPNet-GridView-Custom-Paging-with-PageSize-Change-Dropdown.aspx
This work well. However, I run into an issue. My gridview has template controls in it, which run code when used. For example, I have a button that, when clicked, replaces the cell contents with two different buttons. When I use the pagination technique given above, clicking on any template control (causing postback), erases my gridview. I realize that this is because I have to recreate the gridview on every postback because of the way the pagination is set up. However, when I recreate the gridview, the effects of my button are gone because it has been recreated. I'm not sure how to escape this..
Does anyone have any ideas?
For a specific pointed question,
I am looking to create a gridview with custom pagination that will allow for template controls and extended functionality.
Thank you
Generic information:
IDE: Visual Studio 2012
Language: VB.NET, ASP.NET
Database: SQL SERVER 2008 R2
I fixed this issue by programmatic ally resetting the states of my controls to match what they were before post-back.
I haven't had any issues since setting that up.

collecting data from checkboxlist

Pretty basic question, I have a checkboxlist inside of a wizard control. I need to collect the value of all items that are checked, as well as whatever value is inside of a textbox if "other" is checked, to insert into my database during the Wizard.FinishButtonClick event. How do I do this? I need this in VB, please.
We cannot give you complete code to implement the task you want to implement, but can provide some starting point. Please go through the articles given below. Get back to us if you still have problems in implementing what you want after reading these.
Wizard control in .net
Asp.net and Vb.net wizard
Wizard control
I found all these in a simple google search.

thoughts on asp.net grid controls

All, I am creating a web application and I need to give users the ability to add/edit/delete records in a grid type control. I can't use 3rd party controls so I am restricted to just whats in the box for asp.net (datagrid or gridview) or creating my own. Any thoughts on the best direction to go in. I'd like to keep the complexity level at a dull roar :)
thanks in advance
daniel
You should definitely use edit and insert templates. All you have to do is give the button/link the command name such as insert/delete/update and you can allow the Grid to do most of all the work.
Check out this link
I think you'll learn to love the gridviews because they are pretty powerful.
Gridviews have different item templates that you can use for editing and inserting data. That'd be an easy way to go about it.
As long as you set your datakeyid property to the primary key in the database, you should be able to make template fields based off of whether or not you're editing or inserting data. The command name of the button you use to fire the event will handle the statements required for updating/inserting data.
This is a good site for some examples.
the out of the box grid is not too bad.
Here are a few links on master detail records in asp.net this should get you started on the CRUD opperations.
http://www.exforsys.com/tutorials/asp.net-2.0/displaying-master-detail-data-on-the-same-page.html http://msdn.microsoft.com/en-us/library/aa581796.aspx
http://www.bing.com/search?q=asp.net+master+detail
this is the best site for what you are after
www.Asp.Net
Data Access Tutorials controls
Master/Detail Using a Selectable
Master GridView with a Details
DetailView
Using TemplateFields in the GridView
Control
Others
Beginners Guide to the GridView
Control
The GridView Control
IN-DEPTH LOOK AT THE GRIDVIEW CONTROL

Telerik RadGrid: grid clientside pagination

I have a web service which returns me some data,I am massaging this data and using this as datasource for my radgrid (telerik). The datasource is quite large, and would like to paginate it. I found couple of problems when I paginate it in the server side
I have to bind the grid again for pagination, which essentially means I have to make a call to WS again to get the data. This is an expensive call for me. I would rather forgo the benefits of pagination and would display all the results in the same page, except for it would be a bit clumsy
During the postback RadGrid1.Items.Count happens to be the number of items getting paginated (25- in my case) which is expected as all the items in the datasource are not getting bound. This of course is not an issue. The real issue is that we have some checkboxes which get checked based on some business condition. We add this to our business object/DB later. So if the user has not navigated all the pages, these "checked" items do not get added as pagination limits the "Items" in the grid to those which get bound for that particular page index.
My Thoughts:
I would rather have some sort of client side pagination, where we can hide/show contents than going to the server and doing a databind every time. Though it will return all the results, the UI will not be clumsy and the grid would have "all the items" during postback
Is there a way to do it ?
If it were a regular asp.net gridView, can someone point me to a good article which would serve my purpose
Ram
PS: who else think radgrid is crazy ? (unfortunately I did not make this choice)
Recently during my project implementation (which is built with RadControls and RadGrid in particular) I found a handy example that shows how to get grid data from web service and implement paging with a single call to that web service. Check it out:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/declarativedatabinding/defaultcs.aspx
Dick
[I don't have any experience in using RadGrid as well as Telerik, so this solution may/may not work for you]
Silverlight 3 has native support for pagination, you can get more info at PagedCollectionView
BRIJ MOHAN also wrote a nice tutorial on how to leverage this class as well as other cool features like column grouping.
http://weblogs.asp.net/brijmohan/archive/2009/08/01/silverlight-3-datagrid-columns-grouping-using-pagedcollectionview.aspx

Alternative UI control for large data lists instead of DropDownList

I am using C# and ASP.NET with version 2.0 of the .NET Framework library on this particular project. We are also using the AjaxControlToolkit. The AjaxControlToolkit should have the controls available to make a descent User Interface solution to the problem I'm facing.
I have run into this in a few projects in the last year, and used different solutions in the past. The current design of the project I just picked up, is that there is an <asp:DropDownList> control and on page load a Database call is made to get a list of values. This is then bound using DropDownList's datasource. The problem is that there is 25k items returned from the database. First thing, that's not acceptable for a user to have to scroll through tens of thousands of items. But, even more importantly, is that in every browser that it is tested on (IE 7, FF 3, Safari, and Chrome) the browser completely hangs as it is propagating the dropdownlist items.
What I'm thinking is using a Modal Popup form, which an Autocomplete Extender that allows the user to drill down to a specific company. So, in the field where they have to choose a company, they click on a "select company" icon, the modal form comes up, letting them use the autocomplete extender to select an existing company. They click "Ok" and it save the value to the field.
However, I'm an old school command line/shell/terminal guy, and my ideas of acceptable UI design might be skewed (give me a command prompt on any system, and I'm good to go). I would like the advice of those in the community here as to what they think would be an acceptable solution, or if they have faced other issues like this.
I think your idea for the autocomplete extender is the best solution. I've had this problem as well (sounds similar--a project you are taking over from somebody else). The push-back often comes from the user side. They are used to being able to select from a list of items. Unfortunately as the database grows, this becomes less and less feasible.
But when you have 0.5MB of html downloaded on the page (not including the viewstate), compromises have to be made.
Why do you think you need to create modal popup? Can't you just have the extender on your data entry page?
I had to deal with the same issue. But I ended up using a combobox with paging support and auto complete. Currently this combobox happens to be from Telerik. Its a comboBox for auto complete since you can't type into a droplist.
I agree that no user is going to want to look thru 25,000 items to find the one they want. Is there some way you can limit the data so that they drill down? Like selecting a region or type of company first and then showing the ones that match?
Multiple cascading ListBoxes, each futher refining the resultset of the previous
AJAX AutoCompleteExtender

Resources