Function to identify Validation status

Ask general questions here.
Anbu
Posts: 15
Joined: Tue Feb 14, 2012 10:28 am

Function to identify Validation status

Post by Anbu » Wed Apr 18, 2012 10:56 am

Hi Team,

We are validating some objects in our recording. We want to get the status of the validation (success or failure) inside a code module. Could you please let us know if there is any function or code avaliable to get the validation status(for all validation, not specific to particular type/object).

It would be great if you could share us your thoughts/workaround.

Thank you,
Anbu K

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

Re: Function to identify Validation status

Post by Support Team » Wed Apr 18, 2012 12:11 pm

Hi,
Anbu wrote:We are validating some objects in our recording. We want to get the status of the validation (success or failure) inside a code module. Could you please let us know if there is any function or code avaliable to get the validation status(for all validation, not specific to particular type/object).
You want to receive all validation steps in your solution, right? Do you want to perform this action during runtime or when the solution has finished?

Regards,
Peter
Ranorex Team

Anbu
Posts: 15
Joined: Tue Feb 14, 2012 10:28 am

Re: Function to identify Validation status

Post by Anbu » Wed Apr 18, 2012 12:45 pm

Hi, We have a user Actions recording (Recording1.rxrec) with some validation steps. After each validation step, I need to call a function which posts the defect. For that, I need to know the status of the validation step since the defect should be be posted only when the validation step fails.

We are trying to get the validation status inside code module(Recording1.usercode.vb).

Kindly let us know if this is possible with Ranorex.

Thanks
Anbu K

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

Re: Function to identify Validation status

Post by Support Team » Wed Apr 18, 2012 2:02 pm

Hi,
Anbu wrote:Kindly let us know if this is possible with Ranorex.

Ranorex throws a validation exception if a validation went wrong. If you add a try catch block over your validation action, you could execute any code you want in the catch block.

Regards,
Peter
Ranorex Team

Anbu
Posts: 15
Joined: Tue Feb 14, 2012 10:28 am

Re: Function to identify Validation status

Post by Anbu » Wed Apr 18, 2012 2:39 pm

Hi Peter,

Thanks for your response.

We are trying to get the status of the validation without converting it into user code. Please could you let us know if it is possible to get the validation status by having the validate step as a recorded step in the user actions table?

Regards
Anbu K

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Function to identify Validation status

Post by omayer » Wed Apr 18, 2012 6:06 pm

Hi Peter,
If I add a try catch block over validation action what will be the line of code that will go to the next test case instead of exit out the test run.
Thank you,
Beginner
Tipu

Anbu
Posts: 15
Joined: Tue Feb 14, 2012 10:28 am

Re: Function to identify Validation status

Post by Anbu » Thu Apr 19, 2012 1:19 pm

Hi Peter/Team,

Please could you let us know if we can get the validation(Recorded one) status without using any user code?
Is there any inbuilt option avaible in Ranorex to identify the validation status?

Thank you,
Anbu K

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

Re: Function to identify Validation status

Post by Support Team » Fri Apr 20, 2012 10:16 am

Hi!

It is not possible to do this without writing any user code.
But I can give you tow possible ways to realize it, writing just a few lines of code.

The first one might be:
Create your validation and activate “Continue on fail” for this validation via the context menu of the action.
Afterwards, you should set the property “Report Level on Failure” for this action to “Warn”.
reportlevelonfailurewarn.png
This means that there won't be an exception to the report file, but a warning.
After the validation, define a user code method. In this method, check if there was a warning so far in the current module, if there was a warning, call your method.

Code: Select all

if (TestSuiteModule.Current.HasWarnings) {
  //Call your method
}
The second solution:
Create your validation, convert it to user code (via the actions context menu) and put a try block around the validation. In the catch block, call your method.
E.g.

Code: Select all

try {
  Validate.Attribute(repo.WebDocumentTest_Automation_Tools___.ATagTest_AutomationInfo, "InnerText", "SomeValidation");
} catch {
  //Call your method
}
Best regards,
Martin
Ranorex Support Team
You do not have the required permissions to view the files attached to this post.