How to handle it?
First of all,
I am assuming that the requirements have not been documented for this functionality.
So, proper requirement analysis+ impact analysis (on intended functionality) should be done before testing team can estimate for this hidden/undesired functionality under question:
Now if the organization decides to go ahead with it then such functionality should go through the following steps:
A) Team should analyse the requirements to define the Scope of testing. So, that the testing team can have a clear distinction between a desired feature and a bug. Follow following steps:
1.Document all the requirements
2.Proper impact analysis of this functionality on the existing application should be done and the impacted areas should be carefully identified. Document the impacted areas too.
3.Clarify any open question/queries related to the functionality with the customer. Maintain a query log.
4.Finally, take sign-off from customer on requirements.
B) Testing, like every functionality, will have to be planned and performed for this new functionality. And now, as the testing team understands the scope of testing (defined in step (A)), they can plan better for the testing activities. Testing team should also plan testing activities for impacted areas identified in Step(A).
Test plan to be updated to incorporate the new functionality.
There may be new risks, dependencies, any specific third party tools etc. that might be required to test this functionality. You might have to revisit the acceptance criteria too.*
Planning and execution of manual testing of this functionality. Regression testing of impacted areas to be planned and executed. If, automated test scripts already exist for the application then regression won't be a costly affair.
Note: Management need to have some developers on stand by to fix issues are reported during the testing of this new functionality and in the regression testing of impacted areas.
Question: How much it will cost on QA, management and overall productivity of an application?
The unexpected functionality should be considered as a small testing project and should be estimated accordingly + cost of regression testing.
So, QA will have to spend effort on Step (A) and Step (B) activities listed above.
As far as productivity is concerned, I firmly believe that all this is being done in order to ensure that there is minimum impact on the productivity of application. And if well planned and executed, the impact on productivity would be minimum.
As far as the cost on Management is concerned, I am not sure about it. Because management decisions have different grounds. I mean if they have already made a good profit from the project they might not mind spending on this functionality as a goodwill gesture to the customer. Or, if the customer is giving too much business, then the management still might have to go for it in order to retain the customer. So, there are different factors that affect the management decisions.