nunit3-vs-adapter icon indicating copy to clipboard operation
nunit3-vs-adapter copied to clipboard

Exposing vsts properties via testcontext in case of test plan scenario.

Open abhishkk opened this issue 6 years ago • 3 comments

Description: In vsts, there is vstest v2 task which is used to run tests from build or release pipeline.

From this vstest v2 task, we can run test plan scenario. A test method needs to be associated with a test case in order for it to run via test plan flow. Check here for more info on test method association.

Test method association in VS IDE is currently enabled only for MSTest v1 adapter. We (Microsoft automated testing team) are enabling the association support for MSTest, NUnit and xUnit adapters in VS 2019. Check ask from users to enable the association support here.

Once the association is enabled, users can associate test methods to test case and then run its via test plan flow of vstest v2 task in vsts pipeline.

Issue: Testers might need vsts properties like test run id, test case id, test plan id etc in test method itself. These properties are passed from vsts to test platform in TestCase object's properties bag. Test platform passes these properties further to each adapter.

We recently exposed these vsts properties to test method via testcontext for MSTest v2 adapter. Check PR here.

Ask: NUnit adapter to expose vsts properties via test context.

abhishkk avatar Aug 10 '18 10:08 abhishkk

@cltshivash @PBoraMSFT : FYI

abhishkk avatar Aug 10 '18 10:08 abhishkk

@OsirisTerje - customer reported issue - https://github.com/Microsoft/vsts-tasks/issues/7829

PBoraMSFT avatar Aug 21 '18 06:08 PBoraMSFT

Hi, I thought I would have a think about implementing this feature since I'd find it particularly helpful.

Given that some vsts properties are specific to individual tests (TestCaseId, TestPointId, ...) I imagine the expectation would be to flow the vsts properties through to the property bag for each NUnit test.

However I can't see a way to pass additional information to tests. From what I can understand by looking at the ITestRunner and NUnitEngineAdapter types, the test adapter uses the NUnitEngineAdapter to invoke running tests, providing an NUnit TestFilter and a listener as inputs, neither of which are suitable for those needs. It seems all test specific information (properties/traits) need to be a part of the test package itself. I tried adding additional properties to the discovered tests nodes in the xml and, even though they were visible in Runner.LoadResult, the additional properties weren't accessible from the property bag in the NUnit test.

I'm happy to keep having a look but I feel I'm at a dead end, am I missing anything?

shack05 avatar Oct 17 '20 07:10 shack05