This is probably more of a C# question, but hopefully it is an easy answer.
I am running a large number of reports in TestSDK. This is an example of the code I am using to run a report which works just fine.
public void APBalanceByGLAccount()
{
using (TestExecution.CreateTestStepGroup(ICSMessages.APBalancebyGLAccount))
{
AP632000APBalanceByGLAccount screen = new AP632000APBalanceByGLAccount();
screen.OpenScreen();
screen.Run();
screen.Excel();
}
}
Rather than have this code duplicated 50 times, I want to use a generic method where I just pass in the wrapper and generate the report. When I explicitly setup the screen object above, it automatically gives me access to .Run() and .Excel().
The generic method code below runs and opens the screen for the GL Register report. I just can’t find a way to run the report and export it to Excel.
public static void RunReport<T>()
where T : Wrapper, new()
{
Wrapper screen = new T();
screen.OpenScreen();
//how do i get a reference to pForm in the wrapper which contains the Run and Excel buttons?
//screen.Run();
//screen.Excel();
}
For the GL Register report, I call this method using:
RunReport<GL620500GLRegister>();
The code runs and opens the screen. Yay!
This is the wrapper for this screen:
public partial class GL620500GLRegister : GL620500
{
public c__pform pForm { get; } = new c__pform("viewer_par_tab_t0_s0", "_pForm");
}
I think I need to get a reference to pForm so that the “screen” variable in my method sees the .Run and .Excel commands.
How do I get a reference to those buttons? Since this is being done “generically”, I cannot find a way to reference screen.Run().