Ask a Question

Failure Print's Log Scripts Function - TestComplete 12

SOLVED
felipefigueired
Occasional Contributor

Failure Print's Log Scripts Function - TestComplete 12

“We are having a problem in the version of TestComplete / TestExecute version 12.

We have a SmokeTest script that performs several tests on the system screens every day. If the system displays a failure message, the script performs a Print Screen according to the function below to get only the system image, because we use at least 2 monitors and, however, from the migration this function no longer works.

Can help us, please?

 

Analyzes carried out:

 

- Analysis of the logic, variables and types of variables;

- Function call analysis;

- Analysis of Windows updates. The machine did not receive updates after August / 2016 and even updating remained;

- Analysis of the versions of Windows 7 and 8;

- Isolated function test;

- Test the same code with version 10 of TestExecute / TestComplete successfully;

- Analyze and Test with Antivirus and without Kaspersky Anti-Virus.

- Analysis of project properties.

- Analysis of the X, Y location in the System Desktop and analysis of the Height, System Width;

- Uninstalling SmartBear software and reinstalling;

- Formatting the machine.”

8 REPLIES 8
tristaanogre
Esteemed Contributor

The function is using Log.Warning to log the information. What you are showing in the log files is the result of an Error.  There is no "Warning" message showing in the log so this indicates that, for some reason, your code for taking the screenshot isn't actually executing at all.

 

I appreciate the list of things that you mentioned that were checked, however, there still appears to be some problem in the logical flow of the tests where the specific Log.Warning call is not being executed.  My guess is that the function that is checking for the existance of the failure message is not running the same logic.  The error message posted in the log hints that there is a comparison being made between the name of one object and the name of another object.  So, that's where I'd start looking to figure out what's going on in that comparison and, when it fails the test, why it's not triggering your other code.

It would be helpful to actually have the code that is logging that error message, a description of how the picture logging is being called (is it being called from an event handler or directly in code?), and any other information you may give in specific details.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Robert Thanks for the contact,

Yes, the purpose is to print the error message and inform the log according to the Picture function.
As for logic, I do not think it's the problem, because it's just a log that besides the message, it captures the image according to the parameters (Desktop X, Y, Width and Height of the System).
These 4 parameters are captured at the beginning of the system opening and added in global variables to be used in all scripts.
This function was normally used in version 10 of TestExecute / TestComplete, however when migrating to version 12 it is not working.

Follows a snippet of code

 

 Indicator.PushText("Verificando se existe msg XtraMessageBoxForm");

if( Aliases.Corporate.WaitWindow("*", "JBS Corporate",-1,100).Exists
|| Aliases.Corporate.WaitWindow("*", "Erro",-1,100).Exists
)
{
Options.Run.Timeout = TimeoutValue;


Log.Error('Erro exibido na tela associado a alguma regra. Verificar.','', pmNormal, undefined, Sys.Desktop.Picture(Project.Variables.DesktopX,Project.Variables.DesktopY,Project.Variables.CorporateWidth,Project.Variables.CorporateHeight), -1);

Aliases.Corporate.WinFormsObject("XtraMessageBoxForm", "*").WinFormsObject("SimpleButton", "*").ClickButton();
return false;
}

The fact that the "Log.Warning" is not being executed means that the code leading up to that line of code is problematic.  So, yes, there's still a logical problem in your code in that you are triggering an Error instead of the desired warning.  The problem, though, is not in the Log.Warning line, but something leading up to that point.

 

If you double click on the error line in your test log, which code line does it highlight?  THAT is where your problem is.  Until that error is resolved, your warning message you're looking for will not log.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Robert,

 

My version is 12.10.602.7.

 

Do you think I should upgrade my version to resolve this issue?

 

I don't think that's the problem.

Try something...  In your code, rather than designating X, Y, Height, and Width, just put "Sys,Desktop" in the picture parameter. The way TestComplete works is that doing so will implicitly call the "Picture" method of the object and post it to the log.  Now, this will include the FULL desktop which might include multiple monitors (which, based upon your screenshots, you are using), but at least it will verify that the picture part of the Log.Error is still working.

Next trouble shooting is then to double check and make sure that the variables you are setting are actually integers and are the correct values at that point in the code.  Drop a break point on the line that logs the message with the picture and inspect the variable values.  If the picture isn't logging, the problem might be in those values somewhere.  It's possible that the code you are using to set those values is not setting them properly and, therefore, they aren't doing what you want.

 

Finally, again, because you are using multiple monitors, if your hardware configuration has shifted a bit (such as if a monitor that used to be monitor ID 1 and is now 2 or 3) or if your screen resolution is changing, you could be passing improper values based upon old configurations.

But, essentially, let's start at the top and make sure that you can take a screenshot of your desktop.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

In the annex follows the definition of Integer type variables in the project.

 

They are fed at the start of execution, after the system is opened.

       // Check Corporate Location on Desktop
          Project.Variables.DesktopX = Aliases.Corporate.DXProgramMainForm.DesktopLocation.X;
          Project.Variables.DesktopY = Aliases.Corporate.DXProgramMainForm.DesktopLocation.Y;
  
       // Verify height / width of Corporate
          Project.Variables.CorporateWidth = Aliases.Corporate.DXProgramMainForm.Size.Width;
          Project.Variables.CorporateHeight = Aliases.Corporate.DXProgramMainForm.Size.Height;

 

I used the "Debug" and the "Whatch List" to analyze the variables, and they are correct with the values. 

I just ran the test with Sys.Desktop and it showed error. With Sys.Desktop.Picture () the print screen does correctly, but with the entire Desktop image (attachment). 

As for using multiple monitors, here at the company we use at least 2 because we perform various tasks and a larger Desktop is required to follow some processes.
The problem is that these logs are very heavy if the entire screen print screen is made. 

We used this way 1 year in version 10.

Robert, I got it sorted out.

 

According to your point about logic, I've reviewed all the code.

In the moment of capture the size and location of the program was coming dirt with incorrect values. By clearing and firing the "refresh command" (Aliases.Corporate.Refresh ()) on the controls, it captured the size and location correct. Now the Print Screen Command again only work on the system and even with 2 monitors.

 

Thank you very much for the help and analysis.

 

 

 

 

Felipe Figueiredo

cancel
Showing results for 
Search instead for 
Did you mean: