How to pass parameters from a test to a coded step

1 Answer 137 Views
Coded Steps Coded Tests
Claude
Top achievements
Rank 1
Claude asked on 11 Oct 2022, 03:50 PM

Hello,

I have a coded step "Login_FrameworkTelerik" that requires input such as "User email".

When I add the coded step in my test, I would like to be able to set the "User email" in a way similar to when I provide Text to the built-in action "enter text".

Thank you for the feedback

1 Answer, 1 is accepted

Sort by
0
Elena
Telerik team
answered on 12 Oct 2022, 09:21 AM

Hello Claude,

As far as I understand your question you want to use a coded step instead the recorded one to enter some text. If my assumption is correct, then you can simply convert the built-in Enter text step to code - that way you can see the actual code behind the step and modify it as per your needs, or reuse it in another coded step.

Please, note that the code may differ depending on the enabled and disabled step properties - for example when SimulateRealTyping is set to true there are multiple actions executed before the actual type of the text. 

Take the time to check this suggestion and let me know if it works for you. If this is not what you need, please, elaborate on the scenario you need to cover in the coded step to help me in finding the most appropriate solution. 

Thank you for your cooperation in advance.

Regards,
Elena
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Test Studio course! Check it out at https://learn.telerik.com/.
Claude
Top achievements
Rank 1
commented on 12 Oct 2022, 12:53 PM

Hi Elena,

That is not exactly what I'm looking for. What I need is to be able to set Step Properties for my coded step. Is that possible?

The purpose is to avoid hardcoding these values inside my coded step and to be able to re-use the coded step with different properties values.

Elena
Telerik team
commented on 17 Oct 2022, 07:59 AM

Hi Claude, 

I will share some information which seems to be relevant to your question. If this is still not sufficient for you, please, elaborate on your use case in depth so that we can sort this out. 

Data driven testing

The data driven testing allows you to use different values for some of the step properties - such as the text to enter in an input field. You can use built-in data or external files to take the data from. The data source bound to a test can be also accessed in the coded step

Extracted variables

Test Studio allows you to use extracted variables - the concept covers the scenario when you need to get a value in test runtime and reuse it later in the test. These variables can be also used (set and get value) in coded step

Utility class in code

You can also create a custom utility class to reuse across the tests - here is a sample one.

If you need further assistance, please, prepare a sample test to share and demonstrate the scenario you want to cover. Thank you for your cooperation once again. 

Regards, 
Elena

Tags
Coded Steps Coded Tests
Asked by
Claude
Top achievements
Rank 1
Answers by
Elena
Telerik team
Share this question
or