I assume you mean develop has a few extra commits from remote meaning feature branch diverges a few commits earlier.
Let's say the commit where feature branch diverges from has hash `abc`.
So what I would do is
git checkout abc
# write the test, then suppose hash with test files is xyz
git checkout feature
git rebase --onto xyz abc
You will now have test commit as root of feature branch. And now you can move it wherever you want just like in my original answer.