Generate Image Resources

Ranorex Spy, Recorder, and Studio.
andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Generate Image Resources

Post by andreas.tastler » Wed Sep 26, 2012 10:28 am

Hi

Ranorex 3.3.2 throws errors in all validation steps which use CompareImage.
Ein Teil des Pfades "C:\svn2012\ISAG.NET\ISAG UITests\CH.InnoSolv.UITests.Starter\bin\Debug\RepositoryImages\CH_InnoSolv_UITests_CommonRepository31097da2.rximgres" konnte nicht gefunden werden.
When should the rximgres be generated? I opened the solution in Ranorex Studio and recompiled it, but the rximgres file will not be generated.
What could be wrong?

Regards
Andreas

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Generate Image Resources

Post by Support Team » Wed Sep 26, 2012 1:18 pm

Hi,

Could it be that you forgot to copy the RepositoryImages folder to the directory where you execute the tests?
Could you send us the whole report file which includes the error message?
The file should be created after you have successfully built the project the first time.

Regards,
Markus
Ranorex Support Team
.
Image

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Generate Image Resources

Post by andreas.tastler » Wed Sep 26, 2012 2:19 pm

Hi

Thank you for your response. When I open the solution in Ranorex 3.3.2 and compile it, no rximgres files will be generated in the output folder.

The situation is very strange. When I opened the solution from Ranorex 3.2.1 in Ranorex 3.3.2 the generated code of my recording has changed

Code: Select all

        CompressedImage GueltigBis_ScreenshotEmpty = new CompressedImage(@"
            iVBORw0KGgoAAAANSUhEUgAAAAQAAAAXCAIAAACj0XkcAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
            jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABtJREFU
            KFNjbJm7lwEOgJz/MMAwyvkPCgM4AgDMuOzRoFieBwAAAABJRU5ErkJggg==");

Code: Select all

        CompressedImage GueltigBis_ScreenshotEmpty
        { get { return repo.IsagClient.Orte.mdifrmOrt.GueltigBisInfo.GetScreenshotEmpty(new Rectangle(0, 0, 4, 23)); } }
But now, when I open the recording in the editor in Ranorex Studio it will be switched back to

Code: Select all

        CompressedImage GueltigBis_ScreenshotEmpty = new CompressedImage(@"
            iVBORw0KGgoAAAANSUhEUgAAAAQAAAAXCAIAAACj0XkcAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
            jwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAABtJREFU
            KFNjbJm7lwEOgJz/MMAwyvkPCgM4AgDMuOzRoFieBwAAAABJRU5ErkJggg==");
Are there any settings to control this behaviour? I am pretty shure that I have not changed any project or solutions settings.

Regards
Andreas

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Generate Image Resources

Post by Support Team » Wed Sep 26, 2012 3:20 pm

Hi,

The code change because we changed the way images are saved with 3.3.
The rximgres file doesn't exist in the previous Ranorex versions, this feature was added with 3.3.
Could it be that you build your solution with 3.2.1 and execute it with 3.3?

Regards,
Markus
Ranorex Support Team
.
Image

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Generate Image Resources

Post by andreas.tastler » Thu Sep 27, 2012 8:43 am

Hi
Could it be that you build your solution with 3.2.1 and execute it with 3.3?
I definitly updated all Ranorex installations to releasde 3.3.2

Obvisiouly the problem is not the missing image resource files, but that the code for the compressed image will be generated differently.

When I opened the solution first time the code for images was migrated, which seems to be correct for reading the image out of the image resource file.

Code: Select all

        CompressedImage GueltigBis_ScreenshotEmpty
        { get { return repo.IsagClient.Orte.mdifrmOrt.GueltigBisInfo.GetScreenshotEmpty(new Rectangle(0, 0, 4, 23)); } }
Also, the repository has been modified with an accessor for the images:

Code: Select all

    /// <summary>
                /// Gets the ScreenshotEmpty item image.
                /// </summary>
                /// <returns>The ScreenshotEmpty image.</returns>
                [RepositoryImage("7c0f4f7a-eaa2-4180-ad3e-b8fa4b84dcc6")]
                public CompressedImage GetScreenshotEmpty()
                {
                    return GetImage("7c0f4f7a-eaa2-4180-ad3e-b8fa4b84dcc6");
                }

                /// <summary>
                /// Gets the ScreenshotEmpty item image.
                /// </summary>
                /// <param name="cropRect">The bounds of the sub-image in <paramref name="image"/> to return.</param>
                /// <returns>The cropped image.</returns>
                [RepositoryImage("7c0f4f7a-eaa2-4180-ad3e-b8fa4b84dcc6")]
                public CompressedImage GetScreenshotEmpty(System.Drawing.Rectangle cropRect)
                {
                    return GetImage("7c0f4f7a-eaa2-4180-ad3e-b8fa4b84dcc6", cropRect);
                }
When I open the testcase in recorder, the code will be generated back to old style

Code: Select all

   CompressedImage GueltigBis_ScreenshotEmpty
        { get { return new CompressedImage(@"
            iVBORw0KGgoAAAANSUhEUgAAAAQAAAAXCAIAAACj0XkcAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
            jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAbSURBVChTY2iZuxeOGICs/zAwyvn/HxQGcAQA
            KVnyavKy6+cAAAAASUVORK5CYII="); } }

I can't figure out, why ranorex regenerates the code in old style!

Regards
Andreas

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Generate Image Resources

Post by Support Team » Fri Sep 28, 2012 12:15 pm

Hello Andreas,

It seems to be an issue on our site. We will have a closer look into this issue and get back to you as soon as possible.

Regards,
Bernhard
Ranorex Support Team
.
Image

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Generate Image Resources

Post by Support Team » Mon Oct 01, 2012 4:34 pm

Hello,

We found the reason for the issue. It is a bug and will be fixed it in our next release.

Regards,
Bernhard
Ranorex Support Team
.
Image

andreas.tastler
Posts: 36
Joined: Mon Sep 20, 2010 10:59 am

Re: Generate Image Resources

Post by andreas.tastler » Mon Oct 08, 2012 7:19 am

Thank you.
Regards
Andreas