Amazon Interview Question
Quality Assurance EngineersCountry: India
Interview Type: In-Person
Although, i will have lot of question before I write teh following scenarios, But i have assumed a lot of things before writing the scenario and hence its always better to ask accurate scenario like what is app is it mobile desktop app and ask the meaning for every field to understand the question correctly
Unit test scenarios:
Positive Test Cases
search with no of request and validate that its returning expected result as not more than 100 entries in list
Search with no of request and index
search with no of request and genre name
Search with index it shd prompt that no of request is mandatory
search with genre name it should prompt that no of request is mandatory
search with genre and index it shd prompt that no of request is manadatory with no results
Negative scaenario
Search without entering data in any field
search with invalid input in
Search for genre which has more than 100 valid results and validate that it did not retuen more than 1000 entries
environmental scenarios would be if this list is behaving as expecetd on all other supported devices at the same time doe sit have language support feature if yes I have to excute the scenarios mentioned above in all languages
Integration would be the can I play the returned list and listen to them
my bad ruby. I should have explained it. I "imagine" this object calls SearchEngine which does the searches base on the information from musicList. The question is about writing test cases, so I created SearchEngine to support my test cases.
I edited the pseudocode to clarify the role of SearchEngine. Hope it helps
Your test data and test cases are not covering the cases where multiple results could be returned by SearchEngine (the class under test). If multiple results are considered, then certainly the order of results (SearchEngine would probably return results order by no of requests) have to be tested. Don't you think by using TestNG we could provide optimum test data (using dataProvider) to test the functionalities?
Many specifications are missing from a very general question like this one. For example, should the list be thread-safe? If the question does not specify the requirement you think it is necessary (ie. multiple results of the same genre name), ask the interviewer to clarify, or make an assumption yourself.
Based on the simplicity of the question, I think the interviewer is looking for some unit tests. So my answer was steering to that direction.
If the interviewer wants you to consider a more complex environment (ie. the list is in memcached and can be updated on the fly), I am sure s/he will mention it (or followup questions).
You can perform more sophisticated tests (ie. multi-threaded, mock data objects)
with TestNG. I think TestNG is an excellent tool for integration tests (you can of course use it for unit tests). But the original question was so simple that there is no need to take out the heavy duty tool.
You can of course run with the question and assume a more complex environment to impress the interviewer ;)
Three test cases:
1. test search with only the required parameter (genre) and with optional parameters (index and num of requests)
2. test if music list can handle edge case of 1000 entries
3. test if music list would reject 1001th entry
Using java/junit, here is the init() for each test
}
And here are the 3 tests I listed above
}
- trythis September 06, 2014