Forum Discussion
9 Replies
Sort By
Hi Evgeniy,
Please clarify exactly what time you mean: the project opening time, test execution startup time, entire test execution time, etc. It would be great if you told us the exact time in seconds/minutes so we can evaluate the difference.
Also, please let me know whether you have the test code within your C# application or just run a TestComplete test from the application.- PaygusovEvgeniyOccasional ContributorI mean all time from the project opening before the end of its execution. I just run a TestComplete test from the application (VIA COM) with method RunRoutine(ProjectName, UnitName, RoutineName). From the code TestComplete project runs more slowly in 2 times.
Hi Evgeniy,
Can you send us the entire test project along with the logs of the execution for both cases? You can contact us via the Contact Support form.
It would be great if you also sent us the code of your C# application that starts a TestComplete test.- PaygusovEvgeniyOccasional ContributorI used the example described in TestComplete Help in article "Calling Script Routines via COM"
1) I wrote a script in the environment of TestComplete
2) Then I Run the script from TestComplete, it completed for one minute
3) Then I run the same script from the code in C # (likewise in the example described in the help), script was completed more than 2 minutes
Why it takes longer? Is it possible to somehow speed up this process?
example described in the help:
const string TCProgID = "TestComplete.TestCompleteApplication";
object TestCompleteObject = null;
// Initialize variables
string sProjectFileName = "C:\\Work\\MyProject\\MyProjectSuite.pjs";
string sProjectName = "TestProject";
string sUnitName = "Unit1";
string sRoutineName = "MyRoutine";
// Obtain access to TestComplete
try
{
TestCompleteObject = Marshal.GetActiveObject(TCProgID);
}
catch
{
try
{
TestCompleteObject = Activator.CreateInstance(Type.GetTypeFromProgID(TCProgID));
}
catch
{
}
}
if (TestCompleteObject == null) return;
// Obtain the ITestCompleteCOMManager object
TestComplete.ITestCompleteCOMManager TestCompleteManager = (TestComplete.ITestCompleteCOMManager) TestCompleteObject;
// Obtain the Integration object
TestComplete.ItcIntegration IntegrationObject = TestCompleteManager.Integration;
// We have a reference to the Integration object.
// Now we can use its methods and properties to automate TestComplete.
// Load the project
IntegrationObject.OpenProjectSuite(sProjectFileName);
if (!IntegrationObject.IsProjectSuiteOpened())
{
System.Windows.Forms.MessageBox.Show("The project suite was not opened.");
return;
}
// Save data to a temporary file
System.IO.StreamWriter MyFile = new System.IO.StreamWriter("C:\\TempFile.txt");
MyFile.WriteLine("John Smith,johnsmith@johnsmithscompany.com,05/05/2009,0000-1234-5678-9000");
MyFile.Close();
try
{
// Run the routine
IntegrationObject.RunRoutine(sProjectName, sUnitName, sRoutineName);
// Wait until the test run is over
while (IntegrationObject.IsRunning())
Application.DoEvents();
// Check the results
if (IntegrationObject.RoutineResult != null)
System.Windows.Forms.MessageBox.Show("Script routine returned " + IntegrationObject.RoutineResult.ToString());
else
System.Windows.Forms.MessageBox.Show("Script routine did not return any result");
ItcIntegrationResultDescription LastResult = IntegrationObject.GetLastResultDescription();
switch (LastResult.Status)
{
case TestComplete.TC_LOG_STATUS.lsOk:
System.Windows.Forms.MessageBox.Show("The test run finished successfully.");
break;
case TestComplete.TC_LOG_STATUS.lsWarning:
System.Windows.Forms.MessageBox.Show("Warning messages were posted to the test log.");
break;
case TestComplete.TC_LOG_STATUS.lsError:
System.Windows.Forms.MessageBox.Show("Error messages were posted to the test log.");
break;
}
}
catch (System.Runtime.InteropServices.COMException ex)
{
System.Windows.Forms.MessageBox.Show("An exception occurred: " + ex.Message);
}
finally
{
// Close TestComplete
TestCompleteManager.Quit();
// Release COM objects
Marshal.ReleaseComObject(IntegrationObject);
Marshal.ReleaseComObject(TestCompleteManager);
Marshal.ReleaseComObject(TestCompleteObject);
}
Hi Evgeniy,
Could you please post here or send us via the Contact Support form your project containing logs from both test executions: those invoked from TestComplete and from a C# application? We will look into the test and logs.
Thanks in advance.- JeanLContributorHello,
I have noticed the same thing. Sometimes (very often) it takes a long time (~30 s - 120 s) from TestExecute to start the actual test execution. TestExecute "hangs" after the "Opening the project suite..." message when the Playback bar appears on top right corner. After the hang test is executed normally. I'm also using code based on your sample code (http://smartbear.com/support/viewarticle/11013/) to run the scripts. Did you find any solutions for this problem? It would be great if you would share your conclusions here on the forum, rather than via e-mail, so that everyone else would see what was causing the problem.
I'm using the latest version of TE, but also noticed the same thing with the previous versions.
Hello Jean,
We have found that a possible cause of this issue is multiple unit references and wide usage of global variables. If you have a lot of units, try to minimize the number of references between them and try to get rid of global script variables.
Please let me know if this information helps.- JeanLContributorHi David,
Thank you for the answer. Can you clarify a bit. What do you mean with multiple unit references (5, 10, 50 or 100 references per each unit) and with wide usage of global variables (10, 50 or 100 variables...)?
Also one thing that is strange that the start time varies each time from 20s to 60s.
Hi Jean,
This greatly depends on the number of units and their size. I cannot say an exact number of references/variables, but I can tell that the number is actually '<N of references> * <N of variables>'.
If you want, send us your test project and we will look into your specific case.
Related Content
- 2 years agoianlop
- 11 months agoIso_Yura
- 6 years agovthomeschoolmom