Automated Test Generation Question 1 Consider the following class public class Lock private final static int UNLOCKED 0 private final static int LOCKED 1 private int state public Lock state UNLOCKED public void acquire assert state UNLOCKED state LOCKED public void release assert state LOCKED state UNLOCKED public int getState return state Consider each of the below five tests as a unit of input to Randoop Answer whether that test can ever possibly be generated by Randoop If yes explain whether Randoop 1 Discards the test as illegal or 2 Reports the test as a bug or 3 Adds the test to components for future extension For simplicity assume that Randoop does not check for redundancy and that the contracts it checks not shown for brevity are standard ones e g equals and hashCode Test Can ever be generated If yes what outcome Lock l new Lock l acquire l release Lock l new Lock int s l getState if s 0 l acquire Lock l new Lock l release Lock l new Lock l release l acquire Lock l new Lock l acquire l release l acquire A Yes B No 1 Discards 2 Reports 3 Adds A Yes B No 1 Discards 2 Reports 3 Adds A Yes B No 1 Discards 2 Reports 3 Adds A Yes B No 1 Discards 2 Reports 3 Adds A Yes B No 1 Discards 2 Reports 3 Adds 1 2 3 4 5 Answer 1 A 3 2 B 3 A 1 4 B 5 A 3
View Full Document