For some features it is important that local static caching (or whatever similar approach) works correctly to prevent limit issues for queries. You'd then write a test which ensures e.g. that subsequent calls to the same method do not cause additional SOQL queries.
SOQL already counts queries and throws exception when limit reached. Ideally we should have an official api to get this number from SOQL.
Perhaps (optionally) even combined with the actual results from Limits?
SOQL.getQueries();
SOQL.getLimitQueries();
Additional context
It makes no sense perhaps when running code for real but in Unit Tests where no actual SOQL is done it probably would. The methods could delegate to real Limits class outside of tests for consistent usage perhaps.
For some features it is important that local static caching (or whatever similar approach) works correctly to prevent limit issues for queries. You'd then write a test which ensures e.g. that subsequent calls to the same method do not cause additional SOQL queries.
SOQL already counts queries and throws exception when limit reached. Ideally we should have an official api to get this number from SOQL.
Perhaps (optionally) even combined with the actual results from Limits?
Additional context
It makes no sense perhaps when running code for real but in Unit Tests where no actual SOQL is done it probably would. The methods could delegate to real
Limitsclass outside of tests for consistent usage perhaps.