cancel
Showing results for 
Search instead for 
Did you mean: 

in Testcomplete do we have something similar to a properties file in java?

SOLVED
Highlighted
Contributor

in Testcomplete do we have something similar to a properties file in java?

I have a textfile with lot of variable names and its corresponding value like a config file, which i want to read before starting to run tests. Right now i'm trying to read this file and creating a dictionary object, to fetch those values with key in the code and i also tried with the configparser  module available in python. Wanted to know if there is a easier built-in way to do using TestComplete

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

You can use the Storages object to either read an INI file or an XML file.  You can also create a TestComplete custom binary file or store the information in a registry.  I, personally, use the INI file method to read configuration settings from a file before starting a test.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

6 REPLIES 6
Highlighted
Community Hero

Community Hero

You can use the Storages object to either read an INI file or an XML file.  You can also create a TestComplete custom binary file or store the information in a registry.  I, personally, use the INI file method to read configuration settings from a file before starting a test.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

Highlighted
Contributor

Thank you @Marsha_R I did use the project variables feature earlier to fetch values into different methods

Highlighted
Contributor

Thank you @tristaanogre . I did refer the testcomplete documentation and understood how it is being done

https://support.smartbear.com/testcomplete/docs/reference/program-objects/storages/ini.html

 

I would also like to know the best way to implement it, lets say i have two script units - A and B

In UnitA if create a object to read the INI file and then trying to use it in a different unit

[UNITA]
def Test:
       ini = Storages.INI("C:\MyFile.ini")

What would be the best way to use it in UNITB?

  • Assign "ini" object to Project variable and make use of it elsewhere instead of trying to read it again
  • Or Call [UNITA].Test() and fetch the object using the return statement

 

 

 

 

 

Highlighted
Community Hero

Six one way, half a dozen the other.

Personally, I lean away from using global variables and prefer to reference code units.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Contributor

Thank you

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors