SPONSORS:






User Tag List

Results 1 to 8 of 8

Thread: .ini file

  1. #1
    Senior Member
    Join Date
    Dec 2000
    Location
    Pune, India
    Posts
    135
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .ini file

    What is a .ini file? What help can it provide for automation using SilkTest? Can anyone please provide any example for this?

    ------------------

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    Ireland
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    ini files are like text files. Using SilkTest you can read from these files and write to them. This would be the main use for .ini files

    ------------------

  3. #3
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    ini files (initialization files) are generally where you'll have settings. If you want to see an example, look at the partner.ini file in your installed silktest directory. A lot of applications will write to these files so you'll want to use SilkTest to verify that your application correctly wrote to these files. You can also use an ini file to set variables for your testing needs.

    ------------------
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  4. #4
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    The real beauty of ini files if that you can use them to create complete script portability. Anything that would be hard coded into a script, machine name, user ID, password, ip address, file paths, install paths, DNS names, etc. All of that can be placed into an ini file and accessed in the from the script so that your script is loaded with variables rather than hard coded information.

    Then as the script moves from machine to machine, or user to user, the script should never need editing, only the ini file should be changed.

    A snippet from my ini file looks like this:

    [Common]
    Archive=\\
    BinaryDirectory=\\PVCSArchive\QAStorage\bin
    Transfer Protocol=https
    QADrive=Q:\

    [PrimaryMachine]
    MachineName=DamonsLaptop
    InstallDrive=D:\
    InstallDirectory=\Premera\TriZetto
    NTDrive=D:\
    NTDirectory=WinNT
    NTUsername=us5ch55
    NTPassword=password
    NTDomain=TEST_DOMAIN
    Username=User1
    Password=User1
    IPAddress=255.255.255.1
    PortNumber=443
    WebServerSvcName=W3SVC
    ServerRoot=inetpub\wwwroot\
    ServerScriptsDirectory=inetpub\scripts\

    [SecondaryMachines]
    Count=1

    [SecondaryMachineMultiByte]
    MachineName=null
    InstallDrive=D:\
    InstallDirectory=
    NTDrive=D:\
    NTDirectory=WinNT
    NTUsername=
    NTPassword=
    NTDomain=
    Username=
    Password=
    IPAddress=
    PortNumber=
    WebServerSvcName=

    [BrowsersUsage]
    NS3=FALSE
    NS4=TRUE
    NS6=TRUE
    IE4=FALSE
    IE5= FALSE
    IE6=TRUE

    I access them with a custom function in my include file GetSetupValue(String sSection, String sValue, Boolean bRequired)

    So, the call String sMachName = GetSetupValue(PrimaryMachine, MachineName, True)...
    This would set my string value sMachName to "DamonsLaptop".

    [This message has been edited by DJGray (edited 03-15-2002).]

  5. #5
    Senior Member
    Join Date
    Aug 1999
    Location
    San Diego, CA USA
    Posts
    219
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    I found INI files extremely useful when preparing my automation code for internationalized versions of our product.

    I have a master.ini that contains
    My test frame gets this value and assigns it to the global variable sWSLanguage. (The WS prefix is our notation indicating it's a global variable.)

    I then use this value to build the filename for the next INI file that I need to read which contains Japanese-specific values.
    In this example, sFileName is Japanese.ini.

    You can also write to INI files for a myriad of purposes. For example, to retain the value of a few global variables across testcases. In this case I would read the value from the INI file in my TestCaseEnter and write the value to the INI file in my TestCaseExit. Very slick stuff!

    ------------------

  6. #6
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    I have a script that takes 6 to 8 hours to run, I use .ini files to store where my script left off, so it can restart from that position instead of starting from the beginning.

    I can send you an example if you would like. Please let me know.

    MikeF


    ------------------

  7. #7
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    No one's mentioned the 4Test functions you'll need to work with .ini files:
    <UL TYPE=SQUARE>
    <LI>IniFileOpen
    <LI>IniFileClose
    <LI>IniFileGetValue
    <LI>IniFileSetValue[/list]

    Not as many helpful examples in the SilkTest Help file as one might like, but those should move you in the right direction so long as you understand sections and names.

    - Dave



    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  8. #8
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini file

    Here is a code example:

    [+] INIFile()
    [ ] HANDLE hIni
    [ ] //************************************************** **********************************
    [ ] //* The string variable sSection is used to designate the section of the ini you
    [ ] //* want the script to look at or store into
    [ ] //************************************************** **********************************
    [ ] STRING sSection = "Testcase"
    [ ] //************************************************** ***********************************
    [ ] //* The string variable sName is used to designate the name within the section you
    [ ] //* want to look under in the ini file
    [ ] //************************************************** ***********************************
    [ ] STRING sName = "Last Testcase Completed"
    [ ] STRING sValue
    [ ] INTEGER i
    [ ]
    [ ] hIni = IniFileOpen ("Test.ini") //Open the ini file
    [ ] sValue = IniFileGetValue (hIni, sSection, sName) //Get the current stored value
    [ ]
    [ ] //This area is for executing code, this code is only an example
    [ ] //After each run of the code view the created Test.ini file to see the stored values
    [+] select
    [-] case sValue == ""
    [-] for i = 1 to 5
    [ ] Print(i)
    [ ] IniFileSetValue (hIni, sSection, sName, str(i)) //Store the number
    [-] case sValue == "5"
    [-] for i = 6 to 10
    [ ] Print(i)
    [ ] IniFileSetValue (hIni, sSection, sName, str(i)) //Store the number
    [-] case sValue == "10"
    [ ] i = 1
    [ ] Print(i)
    [ ] IniFileSetValue (hIni, sSection, sName, str(i)) //Store the number
    [-] default
    [-] for i = 1 to 5
    [ ] Print(i)
    [ ] IniFileSetValue (hIni, sSection, sName, str(i)) //Store the number
    [ ]
    [ ]
    [ ] IniFileClose (hIni) //Close the ini file


    MikeF


    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:40 PM.

Copyright BetaSoft Inc.