TestNG unable to make reusable code global. Trying to inherit FileInputStream object through extends functions.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

TestNG unable to make reusable code global. Trying to inherit FileInputStream object through extends functions.

Marwan Sultan
Hello,

I am trying to make a reusable object global.  Where would I place the code below within my method, to make it a global object?  I am also using the "extends" function in other classes.

I want to make the code below global.

Properties prop= new Properties();

FileInputStream fis=new FileInputStream("C:\\Users\\marwa\\eclipse-workspace\\JAVA\\src\\resources\\variables.properties");

prop.load(fis);


Please also see the screenshot.  When attempting to use the code in another class, I get the syntax error shown in the screenshot.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Global Object.JPG (38K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: TestNG unable to make reusable code global. Trying to inherit FileInputStream object through extends functions.

Todd Bradley-2
That is not a TestNG question. It seems like maybe you need to take a basic Java programming class.


Todd.

On Mon, Apr 2, 2018 at 7:47 AM, Marwan Sultan <[hidden email]> wrote:
Hello,

I am trying to make a reusable object global.  Where would I place the code below within my method, to make it a global object?  I am also using the "extends" function in other classes.

I want to make the code below global.

Properties prop= new Properties();

FileInputStream fis=new FileInputStream("C:\\Users\\marwa\\eclipse-workspace\\JAVA\\src\\resources\\variables.properties");

prop.load(fis);


Please also see the screenshot.  When attempting to use the code in another class, I get the syntax error shown in the screenshot.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.