You need to sign in to do that
Don't have an account?

Can a soql query for a report be a static class variable?
I'm trying to pinpoint an error with a test class using a static variable for a query on Report. Given below test class:
@IsTest private with sharing class Example_Test_Class { private static String testReportName = 'My Test Report'; private static Report testReport = [SELECT Id FROM Report WHERE Name=:testReportName LIMIT 1]; @IsTest(SeeAllData=true) private static myTestMethod() { // Access testReport.Id here } }Is this valid? I'm not getting any compiler errors but this feels like a possible code smell.
Yes from my understanding this is possible.