Make more common code fore tests and improve bower