?
Solved

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

Posted on 2014-04-08
1
Medium Priority
?
1,231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
Craig Kehler earned 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project
Suggested Courses

741 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