Today I got this from an interviewer. I am not sure if anyone cell tell me what should be the right way. Thanks
Below is the question
Consider www.google.com's search box and the Google Search button.
Q: How would you test this functionality?
How would you design test automation for 1) above?
When you're testing something, you want to find the points where the function, webpage, application, etc. break. It's unlikely that the interviewer is asking you to test search box portion of the Google homepage itself, as that is fairly simple (it's little more than a text input and a couple submit inputs inside a form), but rather find potential edge cases in the code which takes that input and produces the search results.
So, consider edge cases for a text input and a submit button in a form using a GET action:
What happens if you submit the form with no input?
What happens if you submit the form with too much input? (Both server and browser may impose limits on the URL generated by the GET, and those limits may be different.)
What happens if you include characters which have special meaning in a GET query string such as & and =?
What happens if you circumvent the page entirely, creating a different <form> which submits to the same page as Google's search box? What if you do this with some input values missing?
Related
I am learning French. Every time I use the Force Click on my Mac on a word I don't know, I get a dictionary entry and a translation to English.
But when I want to translate a whole sentence, I have to open Google Translate to do so. (1. Open Google Translate. 2. Copy sentence 3. Paste Sentence) It is pretty annoying to do that 20-30 times a day.
So is there a way to expand the capabilities of Force Click in Safari (or in the best case, in every application which allows "Look Up")?
Let me worry about how I can translate the sentences.
I am open for any kind of creative solution.
Here is the standard pop-up when I force touch
I don't think there is a documented way to achieve this on a force click, but you may want to look at Services.
Basically, you can create an application that provides a service, select some text, and then choose your application's Service menu item from the Services submenu in your Application Name menu (the one in bold where "Hide" etc. are).
The service will then receive a copy of the selection (in an NSPasteboard) and can do whatever it wants with that, or even change it.
I am currently working on a project which has few Id's in the first screen and depending on the Id selected, user is navigated to second page which displays respective Id's information. All the information displayed is retrieved from SQL database.
Here is my question how can I automate this using Selenium.
Thanks in advance
If you have a coding background I would suggest writing some basic automated tests with Selenium WebDriver. This will allow you to find elements on the page via their ids, get text from textfields, click on links, and verify that another page has loaded (sounds like the tasks you wish to perform?). You can structure your tests so they run through the main functionality path (eg. go from log in, to main screen, to another screen, testing all functionality along the way) and then you will only have to write a few tests. If you want full automation it is usually better to have specific requirements for your application and write a separate test for each. The Selenium homepage has some good documentation with code snippets to get you started, and a simple google search should provide you with several tutorials. Good luck :)
I am trying to create a test that can enter a username and password into a login form on a page. However, the textbox name changes on every load of the page, and so the test stops each time I run it.
How can I set up Selenium IDE so that it can identify the text box across refreshes?
I am assuming that the textbox only changes part of the ID and not the entire ID each time.
To work with this I would recommend using xpath like people have put above but make it more robust in that it only find that element each time.
e.g.
//input[contains(#id,'thePartOfTheIdThatNeverChanges')]
or
//input[starts-with(#id,'thePartOfTheIdThatNeverChanges')]
or
//input[ends-with(#id,'thePartOfTheIdThatNeverChanges')]
//form1 (3) - First form element in the HTML
Pulled from here as an example This is making use of XPath. In theory you can make use of XPath to focus on parsing the structure of the XHTML, however this is fairly fragile, so it's not necessarily a wise thing to do but it should take care of your issue.
Does the location of the text box change, or just the name?
You could use a css or xpath selector to get the text box if it is in the same place.
I would recommend CSS because -
a. for the readability
b. for the ease of access (and, in your case, maintainability).
I use firebug for accessing/formulating the CSS identifier.
Can Selenium or any other automated tool check for the proper positioning of elements on a web page?
For example, when you look at OnStartups.com in IE 6, the main content that is supposed to be to the right of the menu is below it instead and you have to scroll down to read it. Can you query and get the coordinates of the div as they are actually displayed, and can you get the coordinates of the viewport to verify that the top left corner is actually within the viewable area?
I think comparing screenshots is the best thing you can do and I'm afraid there aren't robust tools for that, yet.
If I were you, I would create a script that navigates through every page of the site capturing a picture on each and then I would open a folder with all the results and it would probably take less than a minutes to check 20 or 30 of them. Sounds really dumb, but sometimes the easier alternative ends up being the best...
I'm afraid the best you could do is select a standard browser and than compare screenshots of other browser with the reference one.
I can't remember the specific one but some tool like Araxis merge was able to compare screenshots in a pretty intelligent way.
Selenium has assertions to check an element's position and size:
assertElementHeight(locator,pattern)
assertElementWidth(locator,pattern)
assertElementPositionLeft(locator,pattern)
assertElementPositionTop(locator,pattern)
A simple test to check the rendering in the OPs example could be to write
assertElementPositionTop(//*[#id='main_content'],0)
thus checking whether #main_content is rendered at the top or somewhere else.
I am trying to get a spellchecker to check spelling in a text field as the user types. I am well aware that browsers such as firefox have this feature for textfields (but this requires a user to manually enable it in the right click menu.
The ideal script Im looking for would accept an id as a parameter, since the id for the field I want to be checked cannot change.
Thanks
My suggestion would to look at a predictive text tool, similar to the tag-finder that SO uses where you have a dictionary, and as a term is typed, you do some kind of AJAX-y lookup to see if they're typing correctly.
Adding a new word would be similar to adding new tags on SO - if the predicted word is not picked, add it to your dictionary.
I'm sure there are others who have done a similar task, though - and this suggestion might be harder to implement than in sounds in my head.