Application does not open if any other modules after it...

Class library usage, coding and language questions.
gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Application does not open if any other modules after it...

Post by gnm_fheinrich » Thu Jul 11, 2013 11:00 am

Hi!

I got pretty familiar with ranorex in the last weeks but now i have a problem that i cant resolve...

I wanted to create a new test suite to start an application and check for updates....

So I recorded the module for opening the software. Tested: Works!

Then I created a new test case under the first one now with a code module. The application now does not open anymore bot the code module was run successfully ?!?!?!?

Tried out a bit and found out that the application wont open if ANY code or recording module with content is below the first test case that should open the application...

Anyone an idea?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Fri Jul 12, 2013 1:56 pm

Hello,

Could you give me more information what exactly you are doing in the code module and in your recording?
Is it possible to send your solution or a little sample solution? I would like to analyze the issue in more detail.
Thank you!

Regards,
Bernhard

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Mon Jul 15, 2013 9:17 am

Testsuite
--------TestCase1
----------------Host.Local.RunApplication(...) // Running the Windows-Application

--------TestCase2
----------------ANY CODE THAT DOES SOMETHING (for example a Delay or so)




That is my very simple program. Running only TestCase1 by unchecking the second Testcase and run the Testsuite makes the application run perfectly. Checking the second Testcase and running the Testsuite makes the first testcase do nothing and only perform the delay from testcase2.....

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Wed Jul 17, 2013 1:20 pm

Hello,

Thank you for the description, but unfortunately I could not reproduce the issue.
Which version of Ranorex are you using?
Please find attached a little sample solution (Ranorex 4.0.5) and let me know if this works.
Thank you!

Regards,
Bernhard
You do not have the required permissions to view the files attached to this post.

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Mon Jul 22, 2013 8:26 am

Im running Ranorex 4.0.5.

Your sample is working... the only difference to my own project is that i open another program (not calc.exe)...

And if i uncheck the second testcase OR commenting out the delay, my program starts...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Tue Jul 23, 2013 4:04 pm

Hi,

What happens if you create a new solution/project with exact the same actions Bernhard used?
Would this work?
If not could you please reinstall Ranorex with the setup.exe or with the Ranorex-X.exe file?

Thanks,
Markus

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Wed Jul 24, 2013 7:51 am

Well i tried out some things and now i have the following situation:

My Software which I start in Testcase 1 starts perfectly if there is no code executing while its starting. The thing is that the Ranorex report comes before the Program starts:

RUN TESTSUITE --> Console shows "Testcase 1 completed successfully" --> Testsuite closes and shows ranorex report --> Software starts.

And now if i run any code WHILE the software starts, it doesnt open at all.

Why is that??????

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Thu Jul 25, 2013 4:07 pm

Hi,

Could you please check if it would work if you would add the Validate.Exists() method (check if the root element exists) right after the code or action which starts your application (in TestCase1)?

Please also check if it would work if you use the RunApplication method where you also have to define the workingDirectory and the arguments: RunApplication Method (fileName, arguments, workingDirectory). Does it work?

If not please check if it would work when you use the normal .Net way to start an application.
Here is the code to start an app using the .Net methods:
// Prepare the process to run
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = ""; //arguments
// Enter the executable to run, including the complete path
start.FileName = @"C:\Windows\System32\calc.exe"; //Enter the complete path to your exe
start.WindowStyle = ProcessWindowStyle.Normal;
start.CreateNoWindow = true;

// Run the external process
Process proc = Process.Start(start);
I am not sure why this happens, it seems that Ranorex somehow interacts with your Application.
What happens if you track your application (started without Ranorex) during your application starts?

Thanks,
Markus

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Fri Jul 26, 2013 7:36 am

Thanks for your answer.

Unfortunately none of the three ways worked...

It seems Ranorex is kind of blocking my Application, because the test case for starting the application completes successfully and if there is further code that i want to execute by ranorex, the application doesnt start :/


What do you mean by "track" when you say "What happens if you track your application (started without Ranorex) during your application starts?"

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Tue Jul 30, 2013 8:15 am

You're welcome!

With track I mean the tracking functionality of Ranorex Spy, please see the following link for more information: Tracking UI Elements.

Finally could you please check if it is possible to start your application, using the sent code, from a Visual Studio Solution?
Add the code to the main method of the solution and please also add some additional code in order to check if the application starts correctly even if a additional code is executed.

Thanks,
Markus

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Tue Jul 30, 2013 11:12 am

I will try this soon and let you know!

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Wed Jul 31, 2013 8:20 am

Code: Select all

namespace ConsoleApplication2
{
    class Program
    {
        [STAThread]
        static int Main(string[] args)
        {
            int error = 0;

            try
            {
                Host.Local.RunApplication(@"C:\Program Files\ScrapeBox Proxy\scrapebox.exe");

                Ranorex.Delay.Seconds(30);
            }
            catch (RanorexException e)
            {
                Console.WriteLine(e.ToString());
                error = -1;
            }

            return error;
        }
    }
}
I'm not sure if this is what you meant but: This code works... The program starts perfectly...

But this was tested on another machine because I can't install Visual Studio on the machine that actually use to start the program and run the Ranorex routine...

So are there any further solution attempts?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Thu Aug 01, 2013 4:23 pm

Hi,

Thanks for testing it!

You could use the executable in order to start the VS project on the "test" machine.

Would the Ranorex solution (the one which doesn't work properly on your "test machine") work on the "new" machine, where VS is installed?

Regards,
Markus

gnm_fheinrich
Posts: 12
Joined: Thu Jul 11, 2013 10:47 am

Re: Application does not open if any other modules after it...

Post by gnm_fheinrich » Fri Aug 02, 2013 8:08 am

No, it doesnt work on both machines.... Its always the problem with starting the software...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Application does not open if any other modules after it...

Post by Support Team » Mon Aug 05, 2013 4:23 pm

Hi,

Could you please check if you specified any command line arguments in the project settings?
Therefore please open the project's properties window and then click on the "Debug" tab.
Are there any arguments specified?
If yes, please delete them and check if it works.
If this shouldn't work we could schedule an online meeting if this is okay for you?
In order to schedule one please right an email from your companies email address to [email protected].

Regards,
Markus