Solved

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

Posted on 2014-04-08
1
1,099 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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now