cancel
Showing results for 
Search instead for 
Did you mean: 

Deploying Test Complete Automated Tests

Highlighted
Occasional Contributor

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 14
Highlighted
Regular Contributor

RE: Deploying Test Complete Automated Tests

In your project's events, add something like the following in your OnStartTest handler:



Sub dynacom_OnStartTest(Sender)

    set objFSO = createobject("Scripting.FileSystemObject")

    set objFile = objFSO.OpenTextFile("C:\SomePath\TestConfig.txt", 1)

    

    strConfig = objFile.ReadAll

    

    ParseAndApplyConfig strConfig

End Sub




Add whatever configs you want in the text file (could use XML too), and have the ParseAndApplyConfig routine set your variables as you want them depending on what's in the config file. Everytime you start a test the text file is read and the variables are modified.
Highlighted
Occasional Contributor

RE: Deploying Test Complete Automated Tests

Is the ParseAndApplyConfig  something I will need to write? Is there an example somewhere of handling this function?
Highlighted
Regular Contributor

RE: Deploying Test Complete Automated Tests

Hi Mitch,



You can work with environment variables in the TestedApps section here



or



pass arguments in the command line like here in the Remark section



or



Start TE via COM, set variable values with specialized functions and finally start your test.



Sincerely
Simon Glet
Highlighted
Community Hero

RE: Deploying Test Complete Automated Tests

Hi,



Also, you may open your test project in Networked mode (http://support.smartbear.com/viewarticle/26639/, http://support.smartbear.com/viewarticle/28482/) and use Project Variables (http://support.smartbear.com/viewarticle/32457/) that will keep local values for every machine test project was opened from.
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Occasional Contributor

RE: Deploying Test Complete Automated Tests

I notice that the tcls file saves the string variable in some sort of encrypted format - is there a setting I can change so I can set the DB connection string in each file on each tested pc?
Highlighted
Occasional Contributor

RE: Deploying Test Complete Automated Tests

So if I put a variable in Project Suite under Persistent variables and name is ApplicationLocation I can assign in Test Complete a default value and a local value.



When I open the project in networked mode to run under Test Execute on another machine it opens in network mode but the default value is always used. I have looked at the machine specific tcLS file and the variables are not in it.



How do you set the variable in the file for the individual testing machines?
Highlighted
Contributor

RE: Deploying Test Complete Automated Tests

If the names of the VMs where the projects are deployed is known and fixed you could use an OnStartTest event to read the name of the machine using Sys.HostName and based on the name of the machine change the connection string.  Sys Object





A pseudo code example:

Sub GeneralEvents_OnStartTest(Sender)

  Dim machineName

  machineName = Sys.HostName

  Select Case machineName

    Case MyMachine

      ProjectSuite.Variables.connectionString = "C:\MyDatabase"

    Case VM1

      ProjectSuite.Variables.connectionString = "C:\VM1sDatabase"

  End Select

End Sub
Highlighted
Community Hero

RE: Deploying Test Complete Automated Tests

Hi Mitch,



Unfortunately, for the reason that is not clear for me, TestExecute does not provide any UI means to set the local values for the entities that are designed to be the the machine-specific (e.g. Project and Project Suite variables, path to the Tested Applications, checked/unchecked state of the Test Items, etc.). And the encoding method used to store their values in the configuration files is not documented either. The bad news are that despite the obvious benefits and usefulness of project variables and other stuff, there are very little chances that TestExecute will get any means to set their values visually. So you have to elaborate some coding approach from the options set mentioned above, implement it and use.



As a workaround, considering the configuration with TestComplete installed on machine A and TestExecute installed on machine B, and assuming that you need to set the local value of variable C for the B box, I believe, that it is possible to:

-- Set the value of the variable on the A box;

-- Save the project;

-- Copy variable's value from the configuration file that keeps local values for the A box using some external editor;

-- Paste the copied value into the configuration file that keeps local values for the B box using the same external editor and save the modified file;

-- Revert the value of the variable to its initial value on the A box and save the project.

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Occasional Contributor

RE: Deploying Test Complete Automated Tests

So in order to use my Test Complete on my devleopment machien and then deploy to several other machines in order to test under different SQL Server scenarios and Operating Systems I have to change the project each time in my Test Complete and then either copy the values from the config file into the testing machine. Even if I set the code to read the machien name sometimes I want to use the machien with SQL Server 2008, sometimes it would be 2012.



This does not work efficiently for me as these approaches require that I edit the files in Test Complete then upload those changes somehow to my testing machine.



I am very frustrated with my purchase at this point, had I fully understood the lmitations of distributed testing I would have went with QTP over TestComplete/Test Execute.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors