This program is about booking a flight online. Here are some codes: Interface fo
ID: 3700166 • Letter: T
Question
This program is about booking a flight online.
Here are some codes:
Interface for DBManager that Mock Objects fulfill:
}
This mock object returns list of flights that have two flights:
@Override
} }
}
@Override
public List<String> getLocations() { // Ekki notað
return null;
}
@Override
public List<String> getPopularLocations() { // Ekki notað
return null;
}
@Override
public void addBooking(Booking bokking) { // Ekki notað
}
@Override
public Booking searchForBooking(int bookNumber) { // Ekki notað
return null;
Here is the Test fixture:
}
@After
}
@Test
List<Flight> result = controller.search("KEFLAVIK", "PARIS", c1, c2, passengerCount); // Hu?n a? ekki að skila null
} }
} }
}
@Test
@Test
// Just so you have an idea!
Testing the code in Eclipse using JUnit I have a presentation on this subject. We had to do a test fixture we have implemented for one of our controller components. We also used mock objects. My question that I have to answer are Why did you choose the test cases (inputs and expected results) you did? Why do you believe the behaviour covered by your test cases is sufficient? -How do your mock objects simulate behaviour in different test scenarios? Can someone give me some answers and ideas as to how I could answer these questions?Explanation / Answer
Hi,
1. The basic thing to write a test case is to verify and validate the output which we are getting is the expected which we want to get.
As there is some requirements for the project to go through all detail it would be difficult so we create a scenario so that we can test the output which we are getting is it according to the expectation or not.
If you are working or will work in any company which want to give the best service to there client or customer, there will be mandatory rule to follow some test process and to write and execute the test case.
2. we believe the behavior covered by our test case is sufficient as there is some mandatory rule to be followed while creating the test case.thus we trust that all the scenarios are covered in this and the test case should contain the objective of test case why it is created,if necessary write prerequisite step of execution expected result.
3. mock object is your object which is giving input don't need any input and expect for the output and check the out put
for example : You book a ticket
user <---> application which accept input from user <---> render input <--> perform action <--> return ticket status to user
here after mock it will be mock:
test case (mock object) <--->return ticket status to mock
in this situation the mock will provide all the detail such as date of travel passanger name age etc and expect the status from the system.
and check the out is it correct according to the expected output.
test case mock object is for every state different input and expected output.
comment if didn't get any point.
Thank you.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.