A very simplistic method for estimating testing time can be as follows for a typical black box testing assignment .
Total Time=No of cycles*(Time for each testing cycle+time for fixing of bugs found in one cycle)
So if you have an estimated time of testing cycle as 6 days and you expect that the developers are going to take 4 days for fixing bugs found in one cycle and if the number of testing cycles are estimated as 4 then
Total time = 4*( 6+4)
Total time= 40 days

But this is very simplistic model but is useful for simpler projects.

A little more complex model for estimating software testing time involves:
1 Categorizing Software Requirements resulting into number of requirements-they can cover business,technical,functional and performance
2 Using a Complexity Constant ( e.g 1 for simple and 1.5 for complex)
3 Applying Risk Factors (e.g ranging from 1.1 to 1.5)
4 Applying a General Contingency Factor (e.g 1.15-1.35)

So one cycle time =No of requirement*complexity constant*risk factor*contingency factor.

If you are implementing the above methods, the you need to consider some other factors also:
When you run test estimation, you can estimate efforts for tasks belong to the Test Team. You cannot figure out a correct estimation for tasks which much depend on developers such as builds release for testing and bug fixing. Normally Builds are released very late to testers and testers have to change their schedule. In addition, Testers do not know and control how bugs are fixed. That is why the hardest part of test estimation is from test execution phase.

The best way to calculate test efforts is you should know how to size projects with function point approach. However, it is not easy task either.