if I upgrade, I lose spark plan, I need to pay for it?
You can create multiple projects, some on the free plan, and others paid. You can also remove the payment plan and go back to spark. As such, you will not "lose spark plan" if you choose to upgrade in order to use Functions in a project.
Is there any way to get spark plan just for testing?
After March 15, there will be no more option to use Functions for free on the Spark plan. Existing projects will be forced to upgrade, of functions will stop working
You should know that, even if you upgrade to a payment plan, there is a very generous free allowance that gives you use of functions without actually having to pay money. See the details on the pricing page. You get 2 million invocations per month. I think you'll find that very difficult to exhaust if you are just testing.
Also, you can always use the Firebase local emulators for free.