Blog

Latest Updates. News. Insights. Ideas.

September 2016 - Sahi Pro

Five Questions Series: Sahi’s Relational APIs

Posted by | features, web automation, xpath | One Comment

In the fourth post on the Five Questions Series, we have Sahi Relational APIs today.
Previous posts in this series: Sahi Controller, Sahi Logs and Sahi Excel Framework.

What is Sahi Relational API
Some times, elements are not uniquely identifiable by themselves. Identifying them in relation to either some element near them or by the element in which they are contained helps. Sahi Relational APIs help you solve that problem. The Relational APIs can be used even on applications with dynamic ids to easily locate one element with respect to another.

Please list the different APIs (markers) under DOM and Positional Relational APIs
There are 2 kinds of relation APIs: DOM Relation APIs and Positional Relation APIs. DOM relation markers like _near, _in specify that the element should be searched near or within another element. Position relations like under, rightOf, leftOf etc. relate one element to another via their position. The list is as follows:
DOM Relation APIs:
_near, _in, _startLookInside, _stopLookInside
Positional Relation APIs:
_rightOf, _leftOf, _leftOrRightOf, _under, _above, _aboveOrUnder
Parent APIs:
_parentNode, _parentCell, _parentRow, _parentTable

How to identify elements using relational APIs?
Identify the main element or the element which is easily identifiable. Then, anchor it and identify the (hard to identify) element in relation to the main element.
Let us take an example to highlight this. In the sample application, we have three books Core Java, Ruby for Rails and Python Cookbook. We also have a text field against each of them.

Relational APIs: Sample Application

Relational APIs: Sample Application

Suppose, we want to identify the text field against the Ruby for Rails. Notice the accessor of the element when no relational API is used. It reads _textbox(“q[1]”).

Relational APIs: Element Accessor without Relational API

Relational APIs: Element Accessor without Relational API

First, identify the main element. In this case, it is the label?-?Ruby for Rails.

Relational APIs: Identify Ruby for Rails

Relational APIs: Identify Ruby for Rails

Anchor the main element by clicking on the Anchor icon.

Relational APIs: Anchor the main element

Relational APIs: Anchor the main element

Identify the secondary element now. Observe the accessor field.

Relational APIs: Identify the second element in relation to the first element

Relational APIs: Identify the second element in relation to the first element

It reads: _textbox(“q”, _near(_cell(“Ruby for Rails”))).

What is the advantage of using _rightOf/_leftOf compared to _near
Using _near where the element to be found may or may not exist can give you unexpected results. For example, in the table below

Relational APIs: Sample Table with missing elements

Relational APIs: Sample Table with missing elements

Let us say we are looking to check if a delete link exists against all users.

_assertExists(_link(“delete”, _near(_cell(“User Two”)))) may be expected to fail, but it passes.
_link(“delete”, _near(_cell(“User Two”))) actually points to the above highlighted link.

This is because, _near is a DOM relation API and finds an element within 7 ancestors (parent nodes) of the given anchor. In our case this link was found within 2 ancestors of the cell in the next row.

The correct way of asserting this would be
_assertExists(_link(“delete”, _rightOf(_cell(“User Two”)))).
_rightOf forces location only along the same line.

Does Sahi Flex Library (SFL) support the Relational APIs?
Sahi Flex Library (SFL) supports near, inside, leftOf, rightOf and under APIs. The usage of these APIs is a little different from the Sahi relation APIs.
The relation APIs are called as member functions.
_f(“fid”).textinput(“u”).near(_f(“fid”).label(“User”))
_f(“mxC”).datagriditemrenderer(“/@fictitious.com/”).rightOf(_f(“mxComponents”).datagriditemrenderer(“Mary Jones”))

They can be chained to use multiple relations.
_f(“fid”).textinput(“u”).near(_f(“fid”).label(“User”)).inside(_f(“fid”).vgroup(“SettingsPanelView”))

Any other questions in your mind?
Feel free to comment or ask your question(s) and we will get back to you.

Sahi Pro: much more than an automation tool

Posted by | Uncategorized | No Comments

Everyone understands that software testing plays an important role in the overall quality of the product. When we test software, we would expect the teams to test on as many different quality criteria as possible, especially when we would like to expose the risks associated with different quality criteria. Gone are the days when something functional was accepted. Today, customers switch to your competitor the moment they see a dip in the quality of your product. This makes it imperative to have all the corners covered.

Functional Testing
Welcome Sahi Pro in to the picture. Many of you know Sahi Pro as The Tester’s Web Automation Tool. In this blog post, I want to highlight how Sahi Pro can help you cover multiple quality criteria with ease. Most of the testing cycles start with functional testing, smoke tests at the tester’s end. Sahi scores well in functional testing in terms of the following:
– Easy identification of elements
– Provides alternatives to element’s accessor
– Usage of Relational APIs (http://sahipro.com/docs/sahi-apis/relation-apis.html) which lets Sahi relate one element to another
One can use Sahi Pro to test each component individually without facing any problem w.r.t element identification.

Web Services
Sometimes, the UI is not ready for testers to test but the backend is ready and can be tested. If your application uses REST protocols, Sahi Pro comes to your help. Sahi exposes RESTRequest and RESTResponse APIs to work with REST APIs. So many times, everything seems to work fine at the UI layer and fails at the backend. This type of testing will help you understand and pinpoint the exact problem. Feel free to check out how you can use Sahi Pro to access Web Services through REST APIs here: http://sahipro.com/docs/faq/webservices.html

Data Driven Testing
You would also like to perform data driven testing on your application after your smoke tests no longer fail. You can also use Sahi Pro to test with a variety of test data. You could cheat sheets like Test Heuristics Cheat Sheet or You Are Not Done Yet to design your test data. More information on how to use Sahi Pro for data driven testing is here: http://sahipro.com/docs/using-sahi/excel-framework.html#Data driven testing

Even though you are confident of the application’s capability to handle any kind of data thrown at it, you would definitely worry on how the different browsers render your application content. With the constant battle among browsers to gain supremacy, you never know which browser and to be more specific, which browser version might be the nemesis for your support team.

Most Popular Browsers compiled by W3Schools

Most Popular Browsers compiled by W3Schools

Cross-browser Compatibility
So, it is a wise idea to test across browsers and browser versions. Imagine how much time it would take from your testing team’s schedule to test every browser and latest and two previous versions. Add Sahi Pro to your arsenal and Sahi Pro with its powerful multi browser and parallel playback features reduces your testing time for cross-browser compatibility by half. You need not even write any code for capturing screenshots on failure. Sahi automatically waits for page loads and captures screenshots on script failure.

Load Testing
You can now focus on load testing of the application. Sahi Pro lets you run load tests on your application. There are 2 Sahi scripts involved in this. One is used to generate the load. This script is called the noise and is run on a headless browser. The steps in the noise file are generally in an infinite loop so that they never terminate. The other script is called the subject. The subject is the script whose steps you would like to measure periodically at different loads. More details on how to configure and execute is here: http://sahipro.com/docs/using-sahi/load-testing.html

Localization Testing
Happy with the results so far, you now focus on your customers who are all around the world. You take a lot of pride in claiming that your application supports 10+ languages. As a tester, how confident that there are no missing strings or ui issues like overlapping, truncation or text bleed. Will you manually navigate to every screen and see if there are any English strings instead of the localized language? Fear not, use Sahi Pro, enable documentation checkbox to take screenshots at every step and use the power of _setLanguage API by Sahi Pro. Your localization testing is also taken care of. Details on the pre-requisites and configuration can be found here: http://sahipro.com/docs/sahi-apis/multi-language.html

Finally, you could also integrate with your build system and let Sahi Pro run the tests every time a build is triggered. You focus on the thinking part and let Sahi Pro take care of validating the builds and email you the status of the test suite. Your regression suite can be fully automated and you focus on the new changes, the discussion meetings and the cognition process.

If you have followed us so far, you now know that Sahi Pro can be used for
– Functional Testing
– Web Services Testing
– Data-Driven Testing
– Cross-browser compatibility
– Load Testing
– Localization Testing
– Regression Testing

Feel free to download a fully functional version of Sahi Pro from https://crm.sahipro.com/pay/index.php/registration/register and contact us at support[at]sahipro[dot]com if you have any questions.

Happy testing!!!

First Sahi Pro Meetup – How did it go?

Posted by | Uncategorized | No Comments

The first meetup of Sahi Pro was successfully organized.

Date: 26th Aug, 2016
Time: 3 pm to 6 pm IST
Venue: Tyto Software Pvt. Ltd., 1st Floor,
B.C.P. Towers, 386, 9th Main,
HSR Layout, Sector 7,
Bangalore 560102

We had three attendees and we started with a comprehensive demo of Sahi Pro’s features. After the demo, we answered the questions asked by the attendees with respect to their application. They were in the evaluation stage and were in need of an automation tool.
The attendees were pleased with the support they received in the meetup and we were happy that we conducted the first meetup of Sahi Pro to the satisfaction of the audience. Stay tuned for details about the second meetup of Sahi Pro.

Sahi Pro Meetup

Feel free to contact us at support@sahipro.com if you have any questions regarding Sahi Pro. Till next time, happy automating.

Use fully-loaded Sahi Pro FREE for a month. Download Now Request a Demo