This is a migrated thread and some comments may be shown as answers.

Changing the "Code Base Class"

3 Answers 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 10 May 2012, 02:34 AM
I'm using TestStudio Standalone Version, and I've created my own extension of BaseWebAiiTest to handle some extra logging behind-the-scenes by overriding the OnBeforeTestStarted and OnAfterTestCompleted events.  Since I want all of my tests to include that extra logging info, I was wondering if there was any way to configure ArtOfTest.Runner to use my CustomBaseWebAiiTest instead of BaseWebAiiTest.

I've modified "Project Settings→Recording Options→Code Base Class" to be my CustomBaseWebAiiTest class (both with/without its full assembly name) instead of BaseWebAiiTest, but all that appears to do is allow the Recorder to recognize any such classes as being associated with Tests.

On a side-note, when I go to add a Coded Step to a Test that does not yet have a code-behind class, it still creates that code-behind class as an extension of BaseWebAiiTest by default.  If I've modified the "Code Base Class" at all, then that extension needs to be manually changed to "CustomBaseWebAiiTest" outside of TestStudio to match the "Code Base Class"; otherwise it's unusable.  As such, I'd like to report that as a bug, since any code-behind files that TestStudio generates should match its current "Code Base Class".

Moving back on topic, the only way that I appear to be able to make tests use my CustomBaseWebAiiTest class it to explicitly create a code-behind class for each one of them which is an extension of said class.  My issue with that approach is that it means I'll be creating an essentially empty code-behind class for every single test that I have, which seems entirely unecessary and will add a lot of extra clutter to my Test Project.

All this having been said, is there any way that I can configure ArtOfTest.Runner to use whatever my "Code Base Class" is instead of always using BaseWebAiiTest by default?  If this is not currently possible, then I'd like to request it as an feature for TestStudio Standalone Version.

-Max

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 11 May 2012, 05:40 PM
Hello Max,

I think a much easier approach is to place your code into the appropriate methods in an Execution Extension. That way it will apply to every test and/or test list in the project, and you won't have to add to the code-behind file of each test.

I filed a bug report for the other issue you reported. You can track the PITS Issue here: Public URL. Your Telerik points have been updated accordingly.  

Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Max
Top achievements
Rank 1
answered on 11 May 2012, 06:58 PM
Hello again Anthony,

Ah, I somehow missed the Execution Extension page in the Documentation, thanks very much for pointing that out!  It's almost exactly what I'm looking for, but the one minor hiccup is that the DLL has to be pre-compiled and placed in "%ProgramFiles%\Telerik\Test Studio\Bin\Plugins\".  Due to the way my automation environment is set up (which I have no direct control over), having to copy to that directory could potentially cause some issues, and I don't necessarily want any given Execution Extension to apply to every Test Project of mine--perhaps just one of them.

Is there any way that I can apply an Execution Extension to a Test Project without having to copy its pre-compiled DLL to "ProgramFiles%\Telerik\Test Studio\Bin\Plugins\"?  I understand that would mean that said Execution Extension would apply to only that specific Test Project, but I have no major issues with that being the case, if need be.  I also would tend to prefer keeping all of my CS files for a specific Test Project under the same Test Project directory, if possible.

Thanks again for your insight--I really appreciate it!

-Max
0
Accepted
Anthony
Telerik team
answered on 11 May 2012, 10:47 PM
Hello Max,

No, the compiled Execution Extension DLL must be copied to the Plugins folder. And it unconditionally applies to all tests and/or test lists in the project.

If you don't want the code to apply globally, you'll have to use the approach outlined here on a per-test basis.

All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Max
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Max
Top achievements
Rank 1
Share this question
or