Amazon Interview Question for Quality Assurance Engineers


Team: QAE 1
Country: India
Interview Type: In-Person




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

Assertion is used to check the state of a program, test for a condition (mostly pre- and post- and in- conditions). Assert check it and if it does not hold it throws an exception.
The most common way to use it is to add asserts to the beginning and end of methods to check that the state of the object is OK at the beginning and it is OK when ending. But you can use it in loops as well.
These tests are guaranteeing that your algorithm works as it should (see some books on algos that teaches about pre-, post- and maintenance conditions :)

- Selmeczy, P├ęter February 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

looking at this from automation of point of view, another thing can be added i.e. when you are automating a page say, you have the privilage of assert text etc if this basic condition fails the rest of the script will not work. So as Peter said its usually a condition check

- Nandan February 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

An assertion is a statement in the JavaTM programming language that enables you to test your assumptions about your program. For example, if you write a method that calculates the speed of a particle, you might assert that the calculated speed is less than the speed of light.
Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error. By verifying that the boolean expression is indeed true, the assertion confirms your assumptions about the behavior of your program, increasing your confidence that the program is free of errors.

- Shilpa March 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In automation, an assertion refers to a flag which would turn true when a given state is matched.
If by executing a certain piece of code (lets say a function), i expect a certain value to be returned, an assertion would be placed on returned value of function which would turn itself true if a certain output is matched.

Assertions can be very easily turned on or off globally for the running application. Java allows you to enable or disable the checking of assertions during any given runtime context. This is very handy for globally managing assertions as a cross-cutting concern.
You can enable assertions at runtime using -ea switch.

- shashank.upadhyay February 24, 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