just check the code by right click and view HTML source, you wont find test function on the page. If this is the case means you have to get the test function on page load of your third page. Its not getting loaded on that page.
you can create your test function in this way
public void RegisterClientScript()
{
StringBuilder cstext2 = new StringBuilder();
cstext2.Append("<script type=\"text/javascript\"> function Test() {");
cstext2.Append("alert('Test');}");
cstext2.Append(" </script>");
ScriptManager.RegisterClientScriptBlock(this, GetType(), "OnClientItemSelected", cstext2.ToString(), false);
}
and can call this method on the page load of your third page.
UcControl.RegisterClientScript();
Hope it works