Amazon Interview Question for Quality Assurance Engineers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 1 vote

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

{
	@Before
	public void initTest() {
		musicList = new LimitedSizeList<MusicRecord>();
		MusicRecord music1 = new MusicRecord ("Jazz", 1000 , 20605 );
		MusicRecord music2 = new MusicRecord ("Pop", 1005 , 126452 );
		MusicRecord music3 = new MusicRecord ("Country", 1035 , 31209 );
		
		musicList.add(music1);
		musicList.add(music1);
		musicList.add(music1);
	}

}

And here are the 3 tests I listed above

{

	@Test
	// can search() handle the following search options? 
	// search by genre only, search by genre and optional index, search by genre and optional index, num of request
	public void testSearch() {

// pseudocode obj se to perform the searches for the test case
		SearchEngine se = new SearchEngine(musicList);
		
		// test searching music1 with only genre
		MusicRecord music = se.search("Jazz");
		assertEquals (music.genre, "Jazz");
		assertEquals (music.index, 1000);
		assertEquals (music.nRequest, 20605);
		
		// negative test searching music2 with genre and optional index
		music = se.search("Pop", 2014);
		assertNull (music);

		// test searching music3 with genre, optional index and optional request number
		music = se.search("Country", 1035, 31209);
		assertEquals (music.genre, "Country");
		assertEquals (music.index, 1035);
		assertEquals (music.nRequest, 31209);
		
	}
	
	// can LimitSizeList handle edge case of 1000 records?
	@Test
	public void testSizeLimit() {
		for (int i=0; i < 997; i++) {
			// initTest() added 3 records into the test list
			MusicRecord music = new MusicRecord("Genre " + i, 2000+i, 30000+i);
			musicList.add(music);
		}
	}

	
	// will LimitedSizeList throws ExceedSizeLimitException if more than 1000 records added?
	@Test(expected = ExceedSizeLimitException.class)  
	public void testSizeLimitException() {
		for (int i=0; i < 998; i++) {
			// initTest() added 3 records into the test list
			MusicRecord music = new MusicRecord("Genre " + i, 2000+i, 30000+i);
			musicList.add(music);
		}
	}

}

- trythis September 06, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

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

- priti.upadhyay November 08, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Where did you get SearchEngine from?

- Ruby lover September 08, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

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

- trythis September 08, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

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?

- Sujoy September 09, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

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 ;)

- trythis September 09, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I prefer truth table for Genre, Index and number of requests. So we need to test 2*3=8 test cases..

- Praneeth November 19, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More