“Error: Compile Error: Type is not visible: test at line…” was bugging one of my peer developer for a while. For us, it was coming at a line in source code where Test.startTest() call is made, though it can come at any other use of any method from “Test” class.
First we thought that API version of the class is not to the latest, but then we recalled that its not Test.isRunningTest(), but Test.startTest() that is failing, which existed since last 3+ years. Then what could be the problem ?
The problem came because some developer created an apex class named “Test.cls”, its unfortunate that its allowed, but it is. This messed up the Apex runtime and on some occasions it worked but failed on most of the places where we are referring the SYSTEM Test class.
We learned this lesson a hard way, by wasting a lot of time. Posting this to save time of other developers who will google for this strange issue.
Posted the same on IdeaExchange, please promote : https://sites.secure.force.com/success/ideaView?id=08730000000gob7AAA