TestNG ITestContext Usage

setAttribute() to store variablegetAttribute() to get variable
@BeforeSuite
public void BeforeSuite(ITestContext context) {
UUID uuid = new UUID();
String filename = uuid;
context.setAttribute(“fileName”, filename);
}
@Test
public void subscribe_Patient(ITestContext context) {
String path = context.getAttribute(“fileName”).toString();
File file = mew File(path);
}

--

--

--

A self-learner in the programming and automation industry. Keep yourself updated in this journey together ;)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Algorithm Interview Questions 17

Basics of the Command Line!

Monotonic queue

Comparison of Sorting Algorithms

NFS Stale File Handle error and solution

Absolute Social Payments now available via Rocketbot Pro

TickTock Performance Evaluation: Scalability in Terms of CPU Number

Creating AWS Lambda Applications with SAM

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sdet & Updates

Sdet & Updates

A self-learner in the programming and automation industry. Keep yourself updated in this journey together ;)

More from Medium

From Java to C++

Inversion of Control & Dependency Injection

GUI in Java

Naming Convention in Java