locked
Cannot retrieve Test Case ID that is currently running through TFS (vNext) build RRS feed

  • Question

  • Hello,

    In our test we need to retrieve Test Case ID that is currently running through TFS (vNext) build. Previously when we were using XAML build definitions we could get it from TestContext.Properties:

    var testCaseID = TestContext.Properties["__Tfs_TestCaseId__"].ToString();

    Since we started using vNext and 'Run Functional Tests' task there are no any properties related to TFS in TestContext.Properties

    What is the reason that it doesn't supply it to TestContext anymore?

    --

    Best regards,

    Alex

    Thursday, November 2, 2017 3:32 PM

All replies

  • hi Alex,

    you can use the following solution Supplying Run Time Parameters to Tests


    Please use "Mark as Answer" if my post solved your problem and use "Vote As Helpful" if a post was useful.

    Thursday, November 2, 2017 5:20 PM
  • Yes, but, we have a situation when many test cases assigned to the same automation test and inside the test method we have something like below:

    var testCaseID = TestContext.Properties["__Tfs_TestCaseId__"].ToString();

    var parameters = TestManagementHelper.ReadParametersFromTestCase(testCaseID);

    Then we can use those parameters in the test.

    Lets say that we start 'Run Functional Tests' task with test selection from test plan. In the test suite we have 10 test cases and each one holds specific parameters which we want to use to configure our test.

    Relying on post about 'Supplying Run Time Parameters' I cannot understand how we can retrieve inside our test, ID for each test case which will be executed during one 'Run Functional Tests' task run?

    --

    Thanks,

    Alex


    Friday, November 3, 2017 9:00 AM
  • There is another post which is on my opinion related to the same problem

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/bbfa759f-6405-42d2-92fe-dd6fb389a41a/tfs-2015-build-vnext-automated-data-driven-unit-testing-using-test-case-parameters?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/bbfa759f-6405-42d2-92fe-dd6fb389a41a/tfs-2015-build-vnext-automated-data-driven-unit-testing-using-test-case-parameters?forum=tfsbuild

    Friday, November 3, 2017 10:24 AM
  • Hello,

    We have a situation when many test cases assigned to the same automation test and inside the test method we have something like below:

    var testCaseID = TestContext.Properties["__Tfs_TestCaseId__"].ToString();

    var parameters = TestManagementHelper.ReadParametersFromTestCase(testCaseID);

    Then we can use those parameters in the test.

    Lets say that we start 'Run Functional Tests' task with test selection from test plan. In the test suite we have 10 test cases and each one holds specific parameters which we want to use to configure our test.

    Relying on post about 'Supplying Run Time Parameters' I cannot understand how we can retrieve inside our test, ID for each test case which will be executed during one 'Run Functional Tests' task run?

    It happened since we moved from XAML to vNext. Is there some workaround or such parameters does not supported by TestContext.Properties anymore and we need to use another solution for our tests?
    --

    Thanks,

    Alex

    Wednesday, November 8, 2017 10:27 AM
  • Hi,

    There is a related user voice that you can vote and follow it: Pass test configuration variables for a test point directly as a property in TestContext


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, November 25, 2017 3:14 AM
    Moderator