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

Test Class Inheritance

1 Answer 84 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Filip
Top achievements
Rank 1
Filip asked on 28 Jan 2011, 02:49 PM

Hi 

I have multiple Children tests that are executed as 'test-as-step' by parent test. Since all children override the same method OnAfterTestCompleted from BaseWebAiiTest I decided to remove redundancy by introducing new class:  

public class TestStep : BaseWebAiiTest
{
        public override void OnAfterTestCompleted(TestResult result)
        {
            // My custom code goes here
            base.OnAfterTestCompleted(result);
        }
}
  Then I updated all my children tests to inherit from TestStep class rather than directly from BaseWebAiiTest. The solution builds fine but when the tests executes and Parent tries to run any of the Children the following Exeption is thrown:  

Error attempting to execute a Test As Step. Details:
System.ArgumentException: String cannot have zero length.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.GetType(String name)
at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.EnsureTypeExists(Assembly assm, String typeName)
at ArtOfTest.WebAii.Design.Execution.ExecutionUtils.CreateCodedTestInstance(Test test, TestResult result)
at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.InternalExecuteTest(Test test, TestResult initializationResult)
at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteTestInCurrentContext(Test test)

1 Answer, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 28 Jan 2011, 05:39 PM
Hello Filip,

Instead of trying to override BaseWebAiiTest I recommend you create your own test extension dll as documented here, which includes an OnAfterTestCompleted function.

All the best,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Filip
Top achievements
Rank 1
Answers by
Cody
Telerik team
Share this question
or