Thread:Project:Support desk/Trying to create a custom button to old edit toolbar with onClick function/reply

You've defined, but at onClick you're calling. You have to use the same name.

You can even simplify it to:

mw.toolbar.addButton({speedTip:"Hi", onClick: test });

That way, you only need to pass the function name (without the parentheses), because it will work as a function reference itself.