AJ1000
14 years agoOccasional Contributor
Setting variables in COM called from javascript not working
This following peice of javascript works with testcomeplete/testexecute:
var te = new ActiveXObject ("TestComplete.TestCompleteApplication.8");
var tei = te.Integration;
te.Manager.Runmode = 1;
tei.OpenProjectSuite("C:\\Tests\\AJProjectSuite\\AJProjectSuite.pjs");
tei.RunProjectTestItem ("AJ", "Tests_v_1_5");
while (tei.IsRunning())
{
WScript.Sleep(100);
}
te.Quit();
However, when I try to add variables, it does not work -> I get an 'object required' error for line 5 (the documentation states the 'script should be running', but I am unsure what this means, as I want to alter the variables in the project suite before I run the tests which use the variables as part of the login process of my test web site):
var te = new ActiveXObject ("TestComplete.TestCompleteApplication.8");
var tei = te.Integration;
te.Manager.Runmode = 1;
var teproj = tei.GetObjectByName("Project");
var AJtst = teproj.Variables;
AJtst.VariableByName ("GlobalUserName") = "AjUser";
AJtst.VariableByName ("GlobalPassword") = "AjPassword";
tei.OpenProjectSuite("C:\\Tests\\AJProjectSuite\\AJProjectSuite.pjs");
tei.RunProjectTestItem ("AJ", "Tests_v_1_5");
while (tei.IsRunning())
{
WScript.Sleep(100);
}
te.Quit();
How do I get this to work? Note: The javascript is being called from the following Bat file:
How do I get variables to be altered before running the project test item? Please help.
Thanks.
var te = new ActiveXObject ("TestComplete.TestCompleteApplication.8");
var tei = te.Integration;
te.Manager.Runmode = 1;
tei.OpenProjectSuite("C:\\Tests\\AJProjectSuite\\AJProjectSuite.pjs");
tei.RunProjectTestItem ("AJ", "Tests_v_1_5");
while (tei.IsRunning())
{
WScript.Sleep(100);
}
te.Quit();
However, when I try to add variables, it does not work -> I get an 'object required' error for line 5 (the documentation states the 'script should be running', but I am unsure what this means, as I want to alter the variables in the project suite before I run the tests which use the variables as part of the login process of my test web site):
var te = new ActiveXObject ("TestComplete.TestCompleteApplication.8");
var tei = te.Integration;
te.Manager.Runmode = 1;
var teproj = tei.GetObjectByName("Project");
var AJtst = teproj.Variables;
AJtst.VariableByName ("GlobalUserName") = "AjUser";
AJtst.VariableByName ("GlobalPassword") = "AjPassword";
tei.OpenProjectSuite("C:\\Tests\\AJProjectSuite\\AJProjectSuite.pjs");
tei.RunProjectTestItem ("AJ", "Tests_v_1_5");
while (tei.IsRunning())
{
WScript.Sleep(100);
}
te.Quit();
How do I get this to work? Note: The javascript is being called from the following Bat file:
@echo off
echo calling js file
ajay.js
pause
How do I get variables to be altered before running the project test item? Please help.
Thanks.