BaseWebAiiTest inherit

2 posts, 1 answers
  1. Jonas
    Jonas avatar
    20 posts
    Member since:
    Jun 2012

    Posted 28 Nov 2011 Link to this post


    I'm trying to make a class inherit for the BaseWebAiiTest class.

    I've have a GlobalFunc.cs file where i store all my methods that can be used for everything, like LogMessage etc.
    And i don't wanna make a new GlobalFunc each time. So i made a new class. Procedure that inherits from BaseWebAiiTest

    public class Procedure : BaseWebAiiTest


    protected Lazy<GlobalFunc> globalFunc;


    public Procedure()


    globalFunc = new Lazy<GlobalFunc>(CreateGlobalFunc);


    private GlobalFunc CreateGlobalFunc()


    return new GlobalFunc(Log);



    In one of my currect tests called CreateChartOfAccounts that inherits from Procedure (Procedure inherits from BaseWebAiiTest)
    But when i'm doing this all of my steps dissappear and i get a error when i try to run.

        public class CreateChartOfAccounts : Procedure


        [CodedStep("Test Monkey")]

        public void Monkey_test()


           globalFunc.Value.LogMessage("Hello world");


    Error message :
    System.ArgumentException: String cannot have zero length.

    Is it possible to inherit from in my case Procedure? Or how shall i solve this?

    [EDIT : Added attached files]

    Best Regards
  2. Answer
    Stoich avatar
    1 posts

    Posted 01 Dec 2011 Link to this post

    Hello Jonas,

    I was easily able to reproduce this as seen in the following video:

    Basically when you change the inherited class, Project view will no longer recognize that this class is a code-behind class associate with a particular test.

    By default when Test Studio generates a code-behind file it always has the exact same name as the test it’s associated with. It turns out that it always has to inherit one specific class: BaseWebAii test. Any deviation from this causes the class not to be recognized as a code-behind file.

    In the guys from Sitefinity’s usecase they change the inherited class. The code-behind file is lost and any coded steps added to the test immediately disappear (see video). Now when they try to add a new coded step Test Studio attempts to create the code-behind class with the exact same name as the test. However, a class  with this name already exists in the project – the previous code-behind class with the altered  “inheritance”. Thus the error you’re getting occurs.

    At the moment you simply can’t change the inherited class. Instead I suggest that you use a “Utility” class/project. We have a sample project that demonstrates this approach here:

    Best wishes,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top