You should remove the '@' before 'name'; it's not needed anymore (for current jQuery versions).
You're want to return all checked elements with name 'test2', but you don't have any elements with that name, you're using an id of 'test2'.
If you're going to use IDs, just try:
return $('#test2').attr('checked');