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

Can not call method by Telerik

3 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Fion
Top achievements
Rank 1
Fion asked on 15 Oct 2013, 11:14 AM
Hi all,

Here is the issue need your support:

I Added a new class, the method in the class will invoke "log", "find", i instance the class and use it in other class, it comes an error that "InnerException:
System.NullReferenceException: Object reference not set to an instance of an object.
 at ArtOfTest.WebAii.Design.BaseWebAiiTest.get_Log()"

So i want to confirm whether it is possible that we can call the log and find method in this way? attached the example code

Public Class A Inherits BaseWebAiiTest  
#Region "[ Dynamic Pages Reference ]"
.....
#End Region
Public function testA()
Dim bClass as B
bClass = NEW B
bClass.testB(par1)
End Function
End Class

Public Class B Inherits BaseWebAiiTest  
#Region "[ Dynamic Pages Reference ]"
.....
#End Region
Public function testB(par1 as String)
log.WriteLine(par1)
find.By.....
End Function
End Class

3 Answers, 1 is accepted

Sort by
0
Accepted
Velin Koychev
Telerik team
answered on 18 Oct 2013, 10:28 AM
Hello Fion,

It is difficult to say what is the cause of this problem without seeing the entire code. You can try replacing log.WriteLine(par1)with

Manager.Current.Log.WriteLine("par1")

If this doesn't help, please provide us with a copy of your test so we can reproduce the issue on our end and give you a solution.

Let me know if this helps.

Regards,
Velin Koychev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Fion
Top achievements
Rank 1
answered on 08 Nov 2013, 07:35 AM
Hi Velin,

Thanks so much for your suggestion, I have tried based on what you said, get lucky, it worked with add "Manager.Current.", now I'm wondering is there any configuration that I can set "Manager.Current." , for example in global setting or setting property, so that I don't need to add "Manager.Current." in every sentence for find or log.

Thanks in advance!

Regards,
Fion
0
Velin Koychev
Telerik team
answered on 12 Nov 2013, 01:19 PM
Hi Fion,

It is good to hear that this solution worked.

Unfortunately this is the recommended  and the best way for writing this code. 

I hope this helps.

Regards,
Velin Koychev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Fion
Top achievements
Rank 1
Answers by
Velin Koychev
Telerik team
Fion
Top achievements
Rank 1
Share this question
or