Forum Discussion

MitchM's avatar
MitchM
Occasional Contributor
13 years ago

Deploying Test Complete Automated Tests

I have written my tests using Test Complete on my Developer Machine. Once I am ready to run my tests under different scenarios I have Test Execute setup on different VM's to handle different Operating Systems. I have a variable in the main project that is set to allow the application to know if it's in development so it can pick either my local database or the one the VM's use with Test Execute depending on the situation. I am curious how if I can configure these variables without Test Complete - I would like to test against multiple SQL Server instances, thus I would need to change the connection string for each VM.Is there a way I change these variables on the machines that only have Test Execute?

14 Replies

  • I have a similar issue just now. I have the full TestComplete (TC) IDE on my dev machine. We have integrated Test Execute (TE) into our build process which uses Team City. The TE instance exists on a networked VM. I have a global variable in my project setting which I use to switch between local and network mode, but I'm not able to set this via the command line. I can't use a stored global variable that is machine dependant as it also pulls down my TC script code from an online version control repository. So the project is always over-written before it is run. At the moment, we are relying on me remembering to set the gloabl variable before I push the project into the repository. I'd prefer if Team City was able to alter this variable at execution point. I suspect we'll need to look into running it via COM to get this though? Any further suggestions? (Oh, and apologies for this being all one long text. The <ENTER> key is not working in this reply box for me - in IE10 - I get an error in the console when I hit <ENTER> -


    SCRIPT5007: Unable to get property 'toLowerCase' of undefined or null reference

    ckeditor.js, line 31 character 1105


    )
  • Just to add, I have found a solution to this which works for me. I already had a global variable which determined whether I was running on my development machine or "somewhere else". I have now added a check which looks for a dummy folder on the PC that TC/TE is running on. If this folder is found, the flag is set to run local (the folder is created by me obviously ... and will not be present on any other PC/VM), if the folder is not found, the flag is set to network mode. Simple and effective.

  • Hi, this might not be of much use but this is how we deal with Project Variables at work.


     


    In order to provide as much flexibility as possible, except for during dev, our Projects do not contain any Project Variables, instead they are created from ini files at the discretion of the tests as they execute.


     


    Each Project Variable is either:


    1. A configuration setting


    2. The name of a file which contains required data and it is the tests responsibility to process the data.


     


    To facilitate this, we employ a standard pattern of having a setup and teardown for each test that initializes/purges Project variables as required.


     


    This is acheived by using code similar to the following and having ini files in a common location across machines.


     


    // Generic function for iterating through and processing an ini file


    function processIniFile( fileName, optionProcessor ) {


      var iniFile, 


          option,


          optionName;


      if( aqFile.Exists( fileName ) ) {


        iniFile = Storages.INI( fileName );


        for( var i = 0; i < iniFile.SectionCount; i++ ){ 


          section = iniFile.GetSubSectionByIndex( i );


          for( var j = 0; j < section.OptionCount; j++ ) {


            optionName = section.GetOptionName( j );


            option = section.GetOptionByIndex( j, "Not Specified" );


            optionProcessor( optionName, option );


          }


        }


      } else {


        Log.Message( "File " + fileName + " does not exist" );


      }


    }


     


    // Create Project Variables from an ini file


    function initializeProjectVariables( fileName ) {


      processIniFile(


        fileName,


        function( optionName, option ) {


            if( ! Project.Variables.VariableExists( optionName ) ) {


              Project.Variables.AddVariable( optionName, "String" );


            } else {


              Log.Warning( "Updating existing Project Variable " + optionName );


            }        


            Project.Variables.VariableByName( optionName ) = option;


        }


      ); 


    }


     


    // Remove Project Variables for options in an ini file


    function purgeProjectVariables( fileName ) {


      processIniFile(


        fileName,


        function( optionName ) {


          if( Project.Variables.VariableExists( optionName ) ) {


            Project.Variables.RemoveVariable( optionName );


          } else {


            Log.Warning( "Could not remove Project Variable " + optionName + " as it did not exists" );


          }


        }


      );


    }


     


    function testInitialize() {


      var fileName = "C:\\Testing\\AMITestConfiguration.INI";


      initializeProjectVariables( fileName );


    }


     


    function testPurge() {


      var fileName = "C:\\Testing\\AMITestConfiguration.INI";


      purgeProjectVariables( fileName );


    }


     


    Regards,


    Phil Baird

  • Is there any way to vote for a UI approach to configure each machine's variables?

    DIstributed testing has been a kludge from the start, and I end up running the tests on the authoring machine, eating my time and leaving TE licenses unused.



    I'm working out an XML approach that populates variables, but it seems weird that we have to create workarounds like that, and like the above, just to implement a feature that should have been there all along.