Home » .Net Framework

Test Case Data Source - Broken Down


If you record a test case that has parameters in it and, import that as a coded UI test, you automatically get a data source as such added to your code.

<DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "http://tfs.d******l.com:8080/tfs/iec*********on;IECCScalable", "3807", DataAccessMethod.Sequential)> 

How would you break this down in to

Name, ConnectionString, Provider name, so you can open close it etc etc. So it could be used in a config file.

Is this possible?


3 Answers Found


Answer 2

Hey FunnyFox.

I dont want to use Sql, I want to use test  cases as my datasource as per above when it automatically  does it for you. This works perfectly fine if i only want one datasource

But how would i manually great a testcase datasource so i could open  and close  differently datasources throughout the test???


Answer 3

Hey FunnyFox.

I dont want to use Sql, I want to use test  cases as my datasource as per above when it automatically  does it for you. This works perfectly fine if i only want one datasource

But how would i manually great a testcase datasource so i could open  and close  differently datasources throughout the test???

Try this post from Mathew: http://blogs.msdn.com/b/mathew_aniyan/archive/2009/04/16/more-on-data-driving-coded-ui-tests.aspx. He gives the format of the data  source near the bottom.

 For <DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "http://tfs.d******l.com:8080/tfs/iec*********on;IECCScalable", "3807", DataAccessMethod.Sequential)> , it's

TFS Url: http://tfs.d******l.com:8080/tfs/iec*********on;IECCScalable  (where everything before the semicolon is the project collection, and IECCScalable is the team project)

Work Item (Test Case) ID: 3807

The rest is the same as other testing data sources.




I submitted this as a bug to MS Connect (Bug ID : 523251) but thought I'd share it with the Forum as well.

When I add a Requirements-Based Test Suite the first time it seems to work fine and pulled in the child Test Cases;  however, after deleting and re-adding the same User Story to my Test Plan, the Test records no longer come over.

I discovered that what is occurring here is that the Delete action with the Testing Center Test plan under a Requirements-Based Test Suite is actually removing the Requirement-->Test Case parent-child link.   So when I try to re-add this requirement the Test Cases no longer come over.

Steps to Reproduce
1. Defined a Parent Child Relationship between a Requirement and a set of Test Cases
2. Open MTLM and create a Test Suite using the Add Requirement to pull in the the Test Cases
3. Delete the Test Cases within MTLM
4. Repeat step 2 above

Actual Results
No Test Cases added due to the parent-child link being deleted

Expected Results
Parent-child link should not be altered from within MTLM, at least not via this action which is not expected.

I have a very simple method. And I want to test it for both valid and invalid input data. In invalid data I want to catch the exact exception type that I will be mentioned in my test data file.

So here is my method

        public double Divide(double numerator, double denominator)
            if (denominator == 0)
                throw new NullReferenceException("Cannot divide by zero.");
            return numerator / denominator;

Now my Data file is


Now in a single testmethod I want to execute all my test cases.
So here is my test method

                   "TestCase", DataAccessMethod.Sequential)]
        public void TestDivide()
            double numerator = Double.Parse((string)TestContext.DataRow["Numerator"]);
            double denominator = Double.Parse((string)TestContext.DataRow["Denominator"]);
            object result = TestContext.DataRow["ExpectedResult"];

Now I really confused how I can handle all test cases into this method. I shouldn't use  [ExpectedException(typeof(DivideByZeroException)]
test method attribute as my first two test cases then will not work. Please help me how I can solve this problem

Thanks in Advance.





I received a complaint from one of my customers that the "Assign" button in the "Test Manager" dos not change the "Assigned To" field in the Test Case.

I am aware that the purpose of that button is to assign testers to the Test Case.

Is there is any way to link the "Testers" field with the "Assigned To" field so that whenever the "Assign" button is pressed both fields will be changed?





So I have the "parallel" settings set in my test solution to enable test cases to run in parallel. This basically tells the unit test runner, that all my test cases can be ran in parallel. But my problem is that I also have test cases that need to NOT be ran in a parallel fashion. I was hoping that were was a attribute of some sort, but I dont see one available.

So does anyone know if this feature is supported?

My current workaround is to just have one global lock that can be used by any test cases that wants to run synchronously.



I am writting a test plan to test a reporting tool, however I am not able to display cummulative records in the Expected Result column.

E.g. made change and print report with the following layout

EmployeeName  Field Changed
------------         -------------
Julie Roberts      Date of Birth

Tom Cruise        Gender

I want to be able to show both records in expected result colum. I've tried using parameters, but than I have to repeat test steps from start to end before getting to the result which is not what I was hoping.

Any advise?


With MTM i can link all work items to test case, but can i link source code to test case?

My source code is in TFS under same project.


Suppose I have WebTest1.webtest & TestParameters.xml and I wrote AppenderWebTestRecorderPlugin which inherit from WebTestRecorderPlugin to intercept my recorded web tests and append some things to it, 

Here you are the magic


First case: TestParameters.xml and WebTest1.webtest are in the same folder and I wrote

 publicclass AppenderWebTestRecorderPlugin : WebTestRecorderPlugin
 publicoverridevoid PostWebTestDynamicParameterDetection(object sender, PostWebTestRecordingEventArgs e)
 DataBindingAccessMethod.Sequential, "TestParameters");

in this case, I can run the recorded web test and it work just fine

Second case: TestParameters.xml is in the root folder and WebTest1.webtest is in under child folder and I wrote

 publicclass AppenderWebTestRecorderPlugin : WebTestRecorderPlugin
 publicoverridevoid PostWebTestDynamicParameterDetection(object sender, PostWebTestRecordingEventArgs e)
 DataBindingAccessMethod.Sequential, "TestParameters");

in this case, I can't run the recorded web test because of this error "Could not run Web test 'WebTest1' on agent 'AHMED-PC': Could not access table 'TestParameters' in data source 'Config' of test '825555b3-9c97-4540-a75a-1d71b92606d5': Object reference not set to an instance of an object."

the surprise is :


if I opened the recorded web test with external tool (like notpad) and saved it with notpad, Visual Studio ask me to reload the file, ok, run the test, IT WORKS if I close Visual Studio and re-opened the same web test project, try to re-run the recorded web test, IT WORKS

Can somebody help me with this issue, because I will train our QAs to use the new recording tools and It is not acceptable to ask them to restart Visual Studio after recoding any test

Fast response will be appreciated



I added a .csv file as a data source. It only has 4 rows. VS seems to be removing the data from a field in the top two rows, both in the New Test Data Source Wizard and in actual playback. However, when I open the file in code view, the data items are visible in the text.

I cleared the file and added the data rows back in one at a time and checked it each time in the New Test Data Source Wizard view. It was fine for the first three rows, then as soon as I add the fourth one back in, it removes the data items in the top two rows in the sixth column. My data is simply text, although in the third row, there is a number. Still, both the prior two entries and the number entry in that column display in the wizard. However as soon as I add the fourth data row back into the file and view it in the wizard, the first two data items in the column are removed.

This is the strangest thing I've ever seen. I've checked my data and there are no spaces or other entries that should cause this. And again, even with the number in the third row, all displays correctly in the wizard. It isn't until I add the fourth row back in that the problem shows up.

I'd like to see if someone could reproduce it (text in top two rows, single number in the bottom two rows) or know if anyone else has had issues with the New Data Source Wizard.


I want to compare UI grid values to data source SQL table values.

I know how to access single value in the iteration, I want to access all the values outside the iterating function.

I tried accessing through test context, I'm looking for something like


thanks, Ayelet


I have set up a Test Plan with one test configurations, added a test suite and a couple of test cases. I then added another test configuration. Upon returning to Test | Run Tests and opening my test suite the tests cases did not reflect the two test configurations associated to my plan. I then added a new test suiite and associated one of my existing test cases. When I opened Test | Test Run the new test suite only showed the test cases twice once for each test configuration.

I did after creating the second test configuration used the Refresh button and closed out of Test Manager and opened again to see if the new test configuration took affect on my original test suite and it's test cases. It did not.

Is this expected behaviour?

Is there a way to set what test configurations I want test cases or test suites to be executed with?




We would like to know if this is possible.  This is a simple example of our issue.  We have three team projects all in the same Team collection; one for the UI team, one for the Mid tier and one for the backend.  We want to run an End to End test calling test cases from all three team projects and if the test fails on the test case it would log the bug in the same team project as the test case. 

 As we see it now Test manager can only connect to One Team project at a time, not team collection. 

Are there any ways around it, say using the API to call the test using a query or something?

Any and all help would be great




Hi all,

I have four Lists with identical columns :

List 1
List 2
List 3
List 4

I had to merge them, hence i created a data source ( Linked Source ) and merged these lists in SPD. I have used a data view webpart to display some columns from the merged lists data source and everything was working fine.

But now i have a new List : List 5 which also has the same columns like the other four lists and i need to update the data soure such that it is merged list of 5 lists not 4.

i updated the datasource property of the linked source to merge this new list as well. However the contents of List 5 dont appear in the data view webpart. 

Am i missing something here ? 

I dont want recreate the data view web part from scratch eachtime , because in future there might be List 6 , List 7 as well ... 


Can you please tell me the name of any tool (freeware or commercial) which can convert (or import) a use case into a test case?
We are having requirements in the form of use cases and we have to write test cases from these use cases. We need to know if any tool can help us in converting these use cases into test cases.

HI I too have a similar issue....

I don't have app_code folder in my application so when i creating the rdlc file it creates XSD file in the root.

When i try to bind the reportviewer with the XSD file using objectdatasource control it's getting the following error.

The type 'DataSet.......TableAdapters......_time__comisTableAdapters' could not be loaded. If the type is located in the App_Code folder, please check that it compiles. If the type is located in a compiled assembly, please check that the assembly is referenced by the project.

The type 'Dataset.......' could not be found.


Can anybody help me to bind the objectdatasource to that XSD file.
I have installed the RC version of Visual Studio 2010.  I was attempting to add an xsd object to an existing rdlc.  I open the rdlc and do the conversion to RDLC 2008 format when prompted.  What I then want to do is add a datatable from an xsd file I've created.  Something I've done many times in VS 2008.  What happens is when the Data Source Configuration Wizard opens, it opens right to "Choose Your Data Connection"  I can not seem to find a way to get to "Choose a Data Source Type" where I know I can select object.  Did I somehow screw up the installation by choosing web development insted of C# or is there something else I need to do so I can use objects in my rdlc reports?
I have just installed VS 2005 RC.

Tried using the LocalReport control using the exact sample code provided in the help for the Render method.

I keep getting an error during the LocalReport.Render method call - InnerException = "A data source instance has not been supplied for the data source". The dataset and table supplied is valid as it works with the Reportviewer control.

Is there something I am missing or is the sample code wrong?


After installing latest SQL Express 2008 R2 I now seem unable to connect to any data source whatsoever in VS 2010 Pro.

Whatever I select - Access, Excel, SQL Server, MySQL..... - after completing the wizard and testing the connection - always passes test - I get the error 'Unable to add data connection. The given key was was not present in the dictionary'.

I've uninstalled and re-installed VS. Also I tried resetting the settings using devenv /ResetSettings and also tried deleting the user profile folders, rebooting etc. I have no add-ins.

Outside of VS I can use Access or any third-party app to successfully connect to any data source.

Any ideas?


VS2010, vb.net Winforms - dynamic local report processing

I am getting the error "A data source instance has not been suppllied for the data source 'DataSet1'" when I attempt to load a report dynamically.  The dataset contains data.

I have checked and rechecked the code - the reportdatasource name is the same as the data source named in the error message.

This exact code works in VS2008 - is something different in VS2010?  I have done this many times, but not in VS2010 before.

  Private Sub rptForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim o As New clsReports
    Dim dsRpt As DataSet1 = o.ReportTest() 'function which returns DataSet1
    Dim rds As New Microsoft.Reporting.WinForms.ReportDataSource
    Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "Project1.Report1.rdlc"
    rds.Name = "DataSet1_spReport1" 'DataSet1 table name is spReport1
    rds.Value = dsRpt.spReport1

  End Sub


i have an webapplication and i have 2 reports first report give me list with all application i have in my database table when i click on one id of this list it shuld rediract me to the second report that take 2 parameter from first report

inside the first report i set the navigation and send parameter value

when i run my page that have first report it is ok run but when i click on the any id to go to next report that have detailes it give me this error

A data source instance has not been supplied for the data source 'DataSet_ApplicationCV'

i understand that  the datasource for second report not set in report viewer but how can i set both dataset and wht if i have subreports inside the second report

code for report viewer:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="ApplicationReport.aspx.cs" Inherits="Webis.admin.ApplicationReport" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" 
    Font-Size="8pt" Height="100%" Width="100%" ShowBackButton="True">
        <LocalReport ReportPath="admin\Applications.rdlc">
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" 
                    Name="DataSet_ApplicationCV" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 


please can anyone guide me

Hey guys,

I am finding that every new web test I am making, I keep having to add in the same Data Sources (which points to CSV file that contains the URL to my app) which I then reference from my Requests:


Is there a way I can put my DataSource that would be common to all my Web Tests so that in any web test I make going forward I can make reference to:


without having to go" "Add Data Source" -> then Browse for the CSV file etc etc

My goal is to have a single CSV file, where in the future we can alter the URL so that our tests will easily run against multiple environments.

I know I can easily go "Parameterize Web Servers" which is nice, but I dont want to have to change the Context Params on every single web test when we decide to run in different environments, so that is why I am going to CSV/DataSource route.

Can someone help give me some tips on how to most efficiently make my tests Environment agnostic  and provide a true, single point of change for when I want to point all the tests to a new environment?

I feel like I am going down the wrong path.


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure