Inline DataRow is not available on TestContext.DataRow for Inline [DataTestMethod]
See original GitHub issueDescription
Describe the issue you’ve observed I have a test:
[TestMethod]
[TestCategory("VisualParity")]
[DataTestMethod]
[DataRow(TestScreen.Large, LocaleDirection.RTL, Ring.WorldWide)]
public void HomeConsumer_Hero_Screenshot(int screenWidth, string direction, string ring)
{
SetupTest(screenWidth, direction, ring);
// in some later code, where TestContext is passed in...
var screenshotName = TestContext.TestName + "_" + TestContext.DataRow.ItemArray[0];
// ...
}
DataRow is null
Steps to reproduce
What steps can reproduce the defect? Please share the setup, sample project, target platform (desktop, core, uap)
Nothing special besides above test. It is a desktop net45 project
Expected behavior
Share the expected output
I would expect TestContext.DataRow
to be properly populated
Actual behavior
What is the behavior observed?
TestContext.DataRow
is null
Environment
Please share additional details about the test environment. Operating system, Build version of vstest.console, Package version of MSTest framework and adapter
VS2017 15.4 Windows 10 Latest MSTest 1.1.18
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Inline DataRow is not available on TestContext. ...
I have a test: [TestMethod] [TestCategory("VisualParity")] [DataTestMethod] [DataRow(TestScreen.Large, LocaleDirection.RTL, Ring.
Read more >'TestContext' does not contain a definition for 'DataRow'
DataRow where TextContext is a class which has no static property named DataRow so in order to use it you need to create...
Read more >Create Data-Driven Unit Tests - Visual Studio (Windows)
A data-driven unit test can use any of the following kind: inline data using the DataRow attribute; member data using the DynamicData attribute ......
Read more >Unit testing - Data-driven tests - DataMiner Dojo
The DataRow attribute allows you to define inline data for a test method. Consider the following example where a unit test verifies whether ......
Read more >Data-Driven Testing with Visual Studio
Every developer needs to test their own code or have it tested by someone else. Many developers aren't great at testing their own...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
can this be re-opened. it would be really helpful to get access to the test parameters via the TestContext
@AbhitejJohn , is there any other way/workaround to get the data other than from Testmethod parameters when I am using DataRow, I am asking is because my test framework is using [TestCleanup] method to generate test report via reading TestContext to get test name, status etc. And now the datarow in TestContext is null by design if using [DataRow]