I do not think you use counter here is very good. Not like DeviceCapabilities, your test can verify logic exactly. I'd like to redesign your test as:
1. Remove all existing contacts.
2. `contacts.oncontactschanged= function() {//If there are two contacts added, put test_add_flag as true );`
3. Add two separate contacts and check whether there are two same contacts( via  above contactschanged listener)
4. `contacts.oncontactschanged= function() {//If there the desired contact get upated with desired values, put test_update_flag as true});`
5. Update the first contact and check whether it is updated( via contactschanged listener)
6. `contacts.oncontactschanged= function() {//If there the desired contact get removed, put test_remove_flag as true});`
7. Remove second contact and check whether it is removed. (contactschanged listener)
8. Find the first contact and check whether the value is correct.