What is test driven development?
Test Driven Development (TDD) is a development model where the tests for a function / system are written first and then the code is written to match what is expected of a test.
After success of the test and code for the first requirement, we write another test case to fulfil another requirement and repeat the cycle.
What are the advantages of test driven development?
What is the test driven development cycle?
What are Testing Driven Developments shortcomings?
How would you make a test that failed if the test took longer than 5 seconds to run?
@Test (timeout=5000)
put that at the beginning
How would you make a test handle an exception it is supposed to throw?
@Test(expected=IllegalArgumentException.class)
put that at the beginning
What would the syntax look like when you needed to test for a time period and an exception?
@Test (expected=IllegalArgumentException.class,timeout=5000)
at the beginning
When would you need to create your own little algorithm in a test instead of hard coding?
Only in the example where there was randomly generated and was testing for unique elements only.
all of the other types could have been hard coded