Solved

VSTS - Datadriven unit test - No TestContext.DataRow option available

Posted on 2014-04-08
1
1,157 Views
Last Modified: 2014-04-16
Hi Guys,

I have a basic test below which I created as a Visual c# unit test project. The test works fine however when I try to read the data from a csv file I don't get the option to use TestContext.DataRow. This worked fine when I used it in a codedUI project. Do I need to add another reference to my project or is there any other reason why I cannot code it this way

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support;


namespace SeleniumTesting
{
    [TestClass]
    public class UnitTest1
    {
       // [TestMethod]
        [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "data.csv", "data#csv", DataAccessMethod.Sequential), DeploymentItem("data.csv"), TestMethod]
        public void TestMethod1()
        {
            IWebDriver driver = new InternetExplorerDriver(@"C:\Software\Selenium\IEDriver");
            driver.Navigate().GoToUrl("http://www.google.com.au");
            driver.Navigate().GoToUrl(TestContext.)
            
        }
    }
}

Open in new window


Thanks

Gavin
0
Comment
Question by:victoriaharry
1 Comment
 
LVL 6

Accepted Solution

by:
Craig Kehler earned 500 total points
ID: 40004526
If the data source is a list of urls, I think you need to add .DataRow to your TestContext.

I use selenium in java, so I don't have a working example to base that on... but that's what it looks like based on http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.testcontext.aspx
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ejb example issues 3 27
Infrastructure development vs software development 3 60
FInd Image Control Gridview 3 22
SSIS Start 2 21
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question