Hi,
I am currently facing following problem
1) Should I always need *.exe file to perform Ranorex test.
2) Can I add a control to the form and call form.Show() in the testModule of Ranorex and perform some tests on it. If so how to perform this. Main target is to perform some ranorex test to controls alone by adding them to form and executing it in Ranorex by form.show().
Kind regards,
ThN
Testing the Windows application by calling in the Ranorex
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Testing the Windows application by calling in the Ranorex
Hi,
I am not sure I completely got your question.
Could you rephrase it?
You can also execute your tests in Ranorex Studio, just click on the RUN button.
As with other development environments an executable will be automatically generated if you start or build your project.
If you want to perform several actions on different controls of your application I would track them with the Spy tool and perform the actions on the Repository elements, or you could also use the Ranorex Recorder to generate a test script.
Please take a look at our online UserGuide, there you will see how Ranorex works: User Guide.
Regards,
Markus
I am not sure I completely got your question.
Could you rephrase it?
You can also execute your tests in Ranorex Studio, just click on the RUN button.
As with other development environments an executable will be automatically generated if you start or build your project.
If you want to perform several actions on different controls of your application I would track them with the Spy tool and perform the actions on the Repository elements, or you could also use the Ranorex Recorder to generate a test script.
Please take a look at our online UserGuide, there you will see how Ranorex works: User Guide.
Regards,
Markus
Re: Testing the Windows application by calling in the Ranorex
Hi Markus,
Thanks for the reply.
I have already used Ranorex for testing few Windows application. In all my earlier tests I use an executable *.exe. Run the application and then perform the testing operation. But now my problem is that I want to make a ranorex test for each of the individual sub controls (Views). For example if a windows application consists of several views, Now I want to test each individual view seperately.
Each View is a UserControl which I will add them to System.Form (Form.Control.Add(View)) and then show this form as Form.Show(). Now I have to perform tests on this form but I am unable to perform any action on this. Below you can see the Code example:
Thanks for the reply.
I have already used Ranorex for testing few Windows application. In all my earlier tests I use an executable *.exe. Run the application and then perform the testing operation. But now my problem is that I want to make a ranorex test for each of the individual sub controls (Views). For example if a windows application consists of several views, Now I want to test each individual view seperately.
Each View is a UserControl which I will add them to System.Form (Form.Control.Add(View)) and then show this form as Form.Show(). Now I have to perform tests on this form but I am unable to perform any action on this. Below you can see the Code example:
Code: Select all
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
// Initialize an UserControl to be tested
System.Windows.Forms.UserControl myUserControl = new System.Windows.Forms.UserControl();
// Initialize form
System.Windows.Forms.Form testForm = new System.Windows.Forms.Form();
// Add userControl to the form
testForm.Controls.Add(myUserControl);
//show form
testForm.Show();
//Now get sub gui elements of the usercontrol
Table nListView = "/form[@controlname='myUserControl']/container/container[@controlname='panel2']/container/element/container/container/container/container/container[@controlname='panel1']/element/table[@controltypename='NListView']";
// perform operation on this GUIelement
nListView.Click();
}
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Testing the Windows application by calling in the Ranorex
Hi,
I wouldn't create the forms and the tests in one file.
This is not recommended.
I would separate them, is there any particular reason why you make it in one file?
Regards,
Markus
I wouldn't create the forms and the tests in one file.
This is not recommended.
I would separate them, is there any particular reason why you make it in one file?
Regards,
Markus
Re: Testing the Windows application by calling in the Ranorex
Hi Markus,
Thanks for your replay. The reason why I required is that I have many UserControls which I then club them to one View of the tool. But I wished to test individual userControl ranter then entire view in the tool.
Thanks for your replay. The reason why I required is that I have many UserControls which I then club them to one View of the tool. But I wished to test individual userControl ranter then entire view in the tool.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Testing the Windows application by calling in the Ranorex
Your code won't work because the Ranorex automation is executed on the same thread that your user controls runs on. In other words, your user control cannot respond to the Ranorex automation since Ranorex currently uses the thread.
You need to run the automation in a separate thread, or better in another process.
You can still test individual controls, that's just a matter of separating the test cases
Regards,
Alex
Ranorex Team
You need to run the automation in a separate thread, or better in another process.
You can still test individual controls, that's just a matter of separating the test cases

Regards,
Alex
Ranorex Team
Re: Testing the Windows application by calling in the Ranorex
Hi,
Thanks for the replay. In reference to the below example, I also tried using Form.ShowDialog() which works if the form has no control inside. If I add a control(userControl) to the form and then perfom Form.ShowDialog, it throws an error "Cross-thread operation not valid: Control 'ProgressForm' accessed from a thread other than the thread it was created on."
The main aim is to test the individual usercontrols during development. But now I have to wait untill complete developement of the tool, so that I will have an *.exe to test.
Thanks for your support, currently I am following a method of creating a demo Form for individual views for testing where I dont have to wait for the development of complete tool.
Kind regards,
ThN
Thanks for the replay. In reference to the below example, I also tried using Form.ShowDialog() which works if the form has no control inside. If I add a control(userControl) to the form and then perfom Form.ShowDialog, it throws an error "Cross-thread operation not valid: Control 'ProgressForm' accessed from a thread other than the thread it was created on."
The main aim is to test the individual usercontrols during development. But now I have to wait untill complete developement of the tool, so that I will have an *.exe to test.
Thanks for your support, currently I am following a method of creating a demo Form for individual views for testing where I dont have to wait for the development of complete tool.
Kind regards,
ThN
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Testing the Windows application by calling in the Ranorex
Hi,
You're welcome!
The only differences are that you have to build the project and execute the generated exe before you can test the controls.
Regards,
Markus
You're welcome!
You can use the same user control specific code which you used in your Ranorex project in a separate C# project.The main aim is to test the individual user controls during development. But now I have to wait until complete development of the tool, so that I will have an *.exe to test.
The only differences are that you have to build the project and execute the generated exe before you can test the controls.
Regards,
Markus