Can we get hold of current test context in UIPath

Hello
I am using Test Automation project in UiPath to automate ERP testing.
I would like to update the test outcome of the current testcase xaml file as no run if certain condition fails.

how can i do that.

FYI - I am running the tests from azure Dev ops

Hi @rpn_mail

you can follow these steps:

  1. Identify the specific condition in your test case that needs to be checked.
  2. Use an appropriate activity or sequence of activities to evaluate the condition within the test case.
  3. If the condition fails, you can update the test outcome to “Not Run” by modifying the TestContext value.In UiPath Test Automation projects, you can access the TestContext object to get information about the current test case and update its properties, including the test outcome.Here’s an example of how you can update the test outcome to “Not Run” within your test case:

TestContext.CurrentContext.Outcome = TestOutcome.NotRun;

The TestContext.CurrentContext represents the current test case’s context, and the Outcome property allows you to update the test outcome.

Thanks!!

Thank you so much for your quick response.

If you have sample code can you please share? Do I have to add a dependency? if so, which one?

Do i have to add any imports?

I couldnt find a way to get TestContext object in an Invoke code activity.