Friday, August 31, 2007

bind form field to data source - comma in text

Surround commas with double quotes to send to a form field from a text record. This is because VSTS uses the comma as a field delimiter. Even if the first record only contains one field.

,,, = empty since it looks at what's before the comma as field one in that record

",,," = three commas

Thursday, August 30, 2007

Data source to a text file

Record a web test that does something - enter 01/01/2007 in a form field; now you want to change which values are entered in the form field without recording a new test for each value.

Add data source to web test
select OLE DB Provider = Microsoft Jet 4.0 OLE DB Provider
Enter the path to the text file (without including the filename) under Server or filename
Click Advanced
Extended Properties at the top enter "Text;" (without quotes) if the file has a header row or "Text;HDR=NO;" (make sure it's HDR not Hdr & no quotes) if there is no header row
click Test Connection and OK
Select one or more text files in the dialog to select the tables

Edit the text file and enter the values you want to test with

Select the input field where you entered the date under Form Post Parameters
Right click and select Properties
Drop down the Choice list next to Value and select your input file

Run the test to send over the dates from the input file

Adding data binding to a recorded web test

First you need to create the table or text field with the values sent to the web test. I made a text file with one value in each row. Make sure there are no extra line feeds at the end of the file. Then add the data source to the web test.

Here's the MSDN article that describes adding the data source:

There's 2 important things to remember with data binding:

1) Select the data source under the QueryString Parameter or the Form Post Parameter - Properties>Value

2) the setting to iterate through all rows in a table or input file is entered in localtestrun.testrunconfig under Web Test there is a radio button called "Number of run iterations" - select One run per data source row

Here is the MSDN page with a walkthrough on adding data binding to a web test:

Tuesday, August 28, 2007

Automated Testing Tools

Hopefully this information helps someone. I've been using this blog to keep notes about Web Tests in Visual Studio Team System. In the past I would learn something, then forget important details after moving on to the next project.

Here's the tools I have used to implement automated test scripts: (I'm not an expert in any of these tools)

Microsoft Visual Studio 2005 Team Edition for Software Testers - automated web tests, manual tests in Word or text, unit tests, load tests, and generic tests

Rational Visual Test 4.0 - old test tool for Windows applications

Watir – Web application testing in Ruby – module to automate web applications using Ruby script

Selenium remote control – automated web testing -- Java server with dotNet dll for tests written in C#, Python module, and Ruby module

Selenium Recorder – Firefox extension with record and playback for automating web tests

Selenium IDE – Firefox extension to record, edit, and debug tests

Selenium Core - Selenium uses JavaScript and Iframes to embed a test automation engine in your browser. This technique should work with any JavaScript-enabled browser. Because different browsers handle JavaScript somewhat differently, we usually have to tweak the engine to support a wide range of browsers on Windows, Mac OS X and Linux.

pyWinAuto – Python module for automating windows applications

PAMIE - Python Automation Module for Internet Explorer

WebTest recorded using Fiddler fails: The page is performing an async postback but the ScriptManager.SupportsPartialRendering property is set to false

Used the Fiddler Tool to record a web test over an AJAX enabled webpage.

The error on playback is: Primary Request Failed "500 The page is performing an async postback but the ScriptManager.SupportsPartialRendering property is set to false. Ensure that the property is set to true during an async postback."

Resolved by deleting references to Hidden fields.

Under Form Post Parameters: _VIEWSTATE={{$HIDDEN3.__VIEWSTATE}}
Extract Rule with Context Parameter Name: $HIDDEN4.__VIEWSTATE

Monday, August 27, 2007

Getting Started with Team System videos

The videos can be viewed here:

He talks fast and I can't remember all the information. This is the 2nd time I have watched them.

Here's a list of what I forgot or missed (so far):

1) add an application config file to the test project then copy the connection string from web.config file

2) a build is required before the test results can be published; create a build, run tests, publish results, then report a bug from the test result

3) edit the local test run config to add an assembly to code coverage; right click to view the code coverage report after the tests are run

4) The Extraction Rule to extract hidden fields is automatically added to a recorded web test; this could cause a test to fail, so you might need to delete unnecessary rows from the request under the Form Post Parameters folder

5) The Test Manager is used to edit the vsmdi file; this file is stored in XML format; select Test>Windows>Test Manager to view Test Manager

6) Select Test>Windows>Test View to run one or more tests; search for tests using the Keyword Filter; group tests by solution, project, type or other fields

7) Searching in the test view does not edit the test run settings

8) use witexport and witimport to modify the work items on team foundation server; WIT stands for Work Item Type (or use the Process Editor instead)

Tuesday, August 21, 2007

Web Tests for AJAX enabled pages

The Fiddler2 utility is used to capture HTTP requests on AJAX enabled pages:

Run the Fiddler2 utility, open the site in IE and browse pages, select requests in Fiddler, and select File>Save Sessions>as Visual Studio Web Test. Then add existing item to the Test Project. Open the Test in VSTS, select the top node, right click and select Generate Code.

Friday, August 17, 2007

Visual Studio Team System - Recorded Web Tests

Something usually needs modified in the recorded web test. When I replay them it usually fails. Here's one of those times:

The error message says "1 dependant requests failed" The test results show an X next to the request that failed. Edit the recorded web test to find the request. Right click, select Properties, and change "Parse Dependent Requests" to False.

Microsoft Defy All Challenges

These ads are pretty funny. Mine is pretty stupid.

The site lets you edit your own Machinima videos. View and vote for mine, so I'll move up in the rankings--or create your own.

Here's the link: