It is calling twice because the button is inside a span and span has onclick="alert('Boem')", hence when you trigger click on the button then it shows an alert and the same click event propagates to span and shows the alert once again.
You need to stop default behaviour of button using below code:
$(function(){
$('#test1').click(function(e){e.preventDefault();}).click();
});
Demo