Sahi Interview Questions & Answers

4 avg. rating (80% score) - 2 votes

Sahi Interview Questions

    1. Question 1. What Is Sahi?

      Answer :

      Sahi is a tool that helps automate testing of browser based  applications. It is released under an Apache 2 license.If you work with web applications, you need to test the product before each release. Testing can be done manually but it may take a long time and may become repetitive and boring. Automation can make this testing (or checking) very fast and free up the tester for more useful exploratory testing. Typically a 1000 script suite can be executed in as less as 6-8 hours. This means that regression tests can run overnight and you can have results when you come in the next morning.

    2. Question 2. But Does It Not Take A Lot Of Effort To Create And Write Scripts And Maintain Them? We Had Once Attempted It And Failed!?

      Answer :

      Success in browser automation depends a lot on the tool you use. Browser technology has advanced significantly and most tools are unable to keep up with browsers for automation. Sahi’s architecture, however, allows automation of any browser new or old, as long as they support proxies and javascript (which all browsers do).

    3. Question 3. Really? How Does Sahi Work?

      Answer :

      To use Sahi, the browser is configured to use Sahi as its proxy. Once configured, all HTTP requests and responses pass through Sahi. Sahi then injects javascript in relevant HTTP responses. This javascript allows recording of user actions and simulation of events for playback.

    4. Question 4. Sahi Has A Recorder? Is A Recorder Helpful? I Have Heard That Record And Playback Is Frowned Upon ?

      Answer :

      Sahi has a good recorder for recording user actions. Good recorders  are excellent time savers for testers. Pure record and playback does not work however. The recorder is used to record snippets of code and then functions are created which are reused in scripts. Nevertheless, the recorder (or rather the object spy) saves 30 to 40% time spent in identifying elements and creating user flow.

    5. Question 5. Oh, So Do I Need To Know Programming? Does It Involve Coding?

      Answer :

      Some level of programming/coding knowledge would be required. Sahi’s scripting language is Sahi Script which is an extension of Javascript. 

      Javascript is one of the easiest languages to learn and use especially if one writes simple procedural code as is normally needed in testing.

    6. Question 6. Why Not Use Java Or C#?

      Answer :

      Sahi has Java and Ruby drivers. However, testers find Sahi script to  be the easiest to work with. Choose which ever works for your business.

    7. Question 7. But Javascript Cannot Read Files Etc. Right?

      Answer :

      Not really. Javascript on the browser has restrictions. Sahi’s script executes inside a Java process. You can read/write files, connect to databases, and do pretty much anything that Java can.

    8. Question 8. I Have Heard That Testing Code Is Like Development Code. It Needs To Be Architected, Refactored And Maintained Like Production Code?

      Answer :

      No this is not correct. Automation code SHOULD be simplistic without too many conditions/loops/inheritance etc. It is even OK to have duplication in automation code. If a script fails, one should be able to right away suspect the application under test rather than the testing code. This can only happen if the testing code is trivially simple.

    9. Question 9. That Was A Useful Digression On Automation Code. Coming Back To Sahi, How Does Sahi Work With Various Browsers? Do I Need To Write Separate Scripts For Each Browser?

      Answer :

      No. A script written for one browser will work on any browser. Sahi takes care of normalizing the differences across browsers.

    10. Question 10. How Does Sahi Identify Elements?

      Answer :

      Javascript exposes a lot of attributes in the DOM. DOM is the programmatic hierarchical representation of the HTML structure in a page. Sahi uses any of the element’s DOM attributes to identify elements. For example, a button may be identified by the visible text, id, name, css className etc. Sahi’s Controller shows all the identification alternatives that are possible for an element.

    11. Question 11. What Is Xpaths?

      Answer :

      XPaths are frowned upon in Sahi. XPaths are normally used to traverse data represented as XML. HTML structures are not really data but UI representations and are prone to modification. XPaths starting from the root node are almost never useful. One has to then modify it using a regular expression. When a script fails, the first suspect is normally the expression and not the AUT. This wastes a good amount of tester’s time. There are also differences in XPath implementations which add to the tester’s troubles.

    12. Question 12. One Of The Main Problems In Our Current Browser Automation Is That We Need To Add Waits Everywhere. Can You Add Waits In Sahi?

      Answer :

      In 99% cases, Sahi does not need waits. Sahi automatically waits for page/frame/iframe loads and also for any AJAX activity. Even after waiting if a step fails, Sahi retries it 5 times at 2 second intervals before it reports a failure. Due to this Sahi scripts are very stable and have very few false negatives.

    13. Question 13. My Application Uses Lots Of Frames And Iframes. How Does Sahi Handle This?

      Answer :

      Sahi automatically traverses frames and iframes to identify elements. One does not need to specifically choose a frame before working with it.

    14. Question 14. What About Popup Windows?

      Answer :

      Popup windows is a loose term. Some people refer to javascript alerts, confirms and prompts as popups. These popups are suppressed by Sahi during playback, but you can control them in script.The other kind of popup are the popup windows. Sahi allows switching to another window and working on it.

    15. Question 15. Does It Support File Uploads And File Download Dialogs?

      Answer :

      File uploads are handled in a round about way in Sahi. Sahi adds the file to the HTTP request via the proxy. For file downloads, files are automatically downloaded to a temp location by Sahi and the script allows interaction with these files.The file upload part can get tricky in HTML5 apps on some browsers, so you may need to resort to native events which are supported in Sahi Pro.

    16. Question 16. Ok, Once I Have A Few Scripts, Can I Run Them In Batch? Can I Hook Into My Continuous Integration System?

      Answer :

      Yes Sahi has a concept of suites. Suites can be triggered from .bat files, shell scripts and ant. You can trigger Sahi scripts from CI systems using its ant target.

    17. Question 17. Do We Need To Build Reporting Logging Etc ?

      Answer :

      No, Sahi automatically logs all statements that are executed, without the tester adding any code. It also builds a summary report in HTML of all script executions in a suite.

Testing Tools Tutorial

All Tutorials

All Practice Tests

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Testing Tools Tutorial