103 views
in GUI Development by
I have to write a set of steps as common for multiple testcases. So that when customer screen changed I can just change only in common class only. For that I created a common test class and wrote the steps. In my actual test class , created an object of this common class and called the common function. But during execution, exception thrown as Runner value was null. Kindly help me to achieve this.

1 Answer

0 votes
by
Hi SKI,

if I understand you correct, you try to introduce the common teststeps through a dedicated class that gets instantiated inside every of your specific test cases. Instead of doing this I would recommend to create a base class where you are implementing your common test steps. Than you can derive from this class and use your common teststeps inside this derived class. This way has always worked for me.

Best regards,

Julian
by

CommonFunction

Init

Please find the common slot and Init function in my testcase class.

by
Ok, the problem is, that you trying to add a teststep within a teststep which is not possible. Teststeps needs to be defined before the execution of them starts. You can do the following: Your common base class can contain a method that contains the AddStep() calls. Than call this method inside your derived class inside Init(). If you want to call this method multiple times inside the Init() than you can introduce a parameter at this method and construct from this the name that you set at those AddStep() calls (see my second comment).
by

1. I created a common method "EnterAdminPassword" containing AddStep() calls in base class and tried to call this inside derived init method without overriding in derived class. but I got following error

Error Tests::TC1_SetupAdminPassword.Init (10:32) : Unknown identifier 'EnterAdminPassword' found.

2. Then I override the method by calling super(). But then also I got same error. If using super(sender);, getting error "Unknown identifier 'sender' found."

3. So I created a slot in derived class and called the overrided method EnterAdminPassword inside the slot. But that time, the AddStep is not worked. In AddStep calls I have given SendTouchEvent().

Can you please confirm BaseCommonMethod . here EnterKeya and EnterKeyd are slots inside base class.

Can you please help to follow the proper approach.

by

Your BaseCommonMethod looks fine. No need to overwrite this inside your derived calls. Are you calling this inside your derived class Tests::TC1_SetupAdminPassword.Init() like:

AddStep( "SomeOtherStep", onSomeOtherStep, 1000 );
EnterAdminPassword();
AddStep( "SomeOtherStep2", onSomeOtherStep2, 1000 );

 

by
Sorry. I called AddStep( "EnterAdminPassword", EnterAdminPassword, 1000 ); inside derived Init.

Now I corrected and working fine.

Great thanks for your time and support.

Embedded Wizard Website | Privacy Policy | Imprint

...