queries regarding alignment, background colour verification

Class library usage, coding and language questions.
krany
Posts: 9
Joined: Sun Mar 30, 2014 4:52 pm

queries regarding alignment, background colour verification

Post by krany » Tue Apr 01, 2014 3:02 am

Hi team,
I've few questions to get resolved and run in ranorex. Here are the questions,
1) I have a test case to executive where I need to check the alignment of text and background colour of the page and specified area.
For eg. I need to check the alignment of the text whether it is to the right or left etc., so how do I check this?
2) secondly, I wanted check drag and drop functionality,
For eg., take igoogle: there are certain elements or say widgets present on the page which can be dragged to any place on the page. So now the question is how can I verify that the widget is dragged to page and show that it's not present in the earlier position.
3) thirdly, I want to create user defined functions which can be reusable in later part of the test cases.
For example, if there is a page that is to b launched then I don't want to write the coding for that like,
Host.openbrowser.("url","browser ",true,true);
I just want to create function n call like in qtp
Call launch()

So I kindly request anyone of you to resolve this and get back to me at the earliest. This is urgent to me as I am working on ranorex tool for my project.
Thanks in advance,
Krany

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

Re: queries regarding alignment, background colour verification

Post by Support Team » Fri Apr 04, 2014 5:20 pm

Hello krany,
I have a test case to executive where I need to check the alignment of text and background colour of the page and specified area.
For eg. I need to check the alignment of the text whether it is to the right or left etc., so how do I check this?
It depends on the properties of your application. Please read the forum post Is there a way to find out alignment of labels?, which was written from one of my colleagues.
2) secondly, I wanted check drag and drop functionality,
For eg., take igoogle: there are certain elements or say widgets present on the page which can be dragged to any place on the page. So now the question is how can I verify that the widget is dragged to page and show that it's not present in the earlier position.
You can for example use the Validation action in order to check if the element is available.
A detailed description can be found in our online user guide on the section "Additional Editing Options"
3) thirdly, I want to create user defined functions which can be reusable in later part of the test cases.
For example, if there is a page that is to b launched then I don't want to write the coding for that like,
Host.openbrowser.("url","browser ",true,true);
I just want to create function n call like in qtp
Call launch()
Yes, you can create a user code action in one recording and execute the method in another one.
For example, there is a user code action in Recording1:
public void methodInRecording1()
{
	Report.Info("I am in Recording1");
}
You can access the method within Recording1 from another recording using:
Recording1.Instance.methodInRecording1();
Regards,
Bernhard
.
Image

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: queries regarding alignment, background colour verification

Post by krstcs » Mon Apr 07, 2014 1:50 pm

The best way to handle your third issue is to create modules that are very small and only have them do one thing.

So, in your case, you would have a module called, for example, "Open_Browser_to_URL".

It would have 2 variables, "Browser" and "URL", which could be bound to Global Parameters so they can be changed at runtime through the command-line, or they could be bound to data connectors so they could change during the test based on the data you pass.

Your module would only call the Host.OpenBrowser() method, and, therefore, could be used anywhere you need to in your test.


Always try to make your modules as small as possible so they can be reused as much as possible.

For another example, take clicking on an "OK" button. Just have a module called "Click_OKButton". All it does is one action (OKButton.Click()). And if you set the path to the OKButton object to be able to catch any OK button (say "//button[@text="OK"]") then you can use it anywhere in your test.
Shortcuts usually aren't...