Answered

Can We pass Arguments in to Functions in Subject7

Hello,

can we pass Arguments into Functions in Subject7..?

currently for using values inside functions, we have to set variable before calling the function every time for each variable, so to reduce/mitigate those steps, it's better pass them as arguments to the functions.

0
4 comments
Avatar
Joseph Hamdan

Hi Yathish,

Your post was moved to a feature request which will be evaluated soon. Until this feature request is planned for a release, we suggest to keep using the workaround with Set_Var that you are currently using.

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Yathish,

Could you please elaborate on your particular scenarios as this will greatly help us with future implementation. If you can add in as much detail as possible, we would really appreciate it.

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Yathish Kempashanaiah

Hi Joseph,

Thanks for your quick response, what i meant to say was, In any programming language the functions always takes arguments, so when we are sending arguments to a function, the variables in the function depends upon the arguments sent to that function or the variables declared inside the function, most of the times they don't depend on Global variables (what we are doing in Subject7). 

for a scenario in subject7,

say for ex. I have to enter some value in a web element, and i need to verify the value has been entered into the element or not. in order to perform this in subject 7, i need to have below steps.

1. Fill Text in webelement

2. Get Text from Webelement

3. Compare the text we got in step 2, matches with the test in step 1

 

if i wrap this inside a function, means, i need to do set_var for locator value, and set_Var for text, every time before i am calling the function.

or if i don't want to do set_var, then, i need to use the above 3 lines, for each textbox in my test script.

so, if i can pass, locator and text as arguments to the function, it's going to mitigate setting variables before calling that function also, using those 3 lines, everytime i fill text in to textbox. and also, the code looks clean, with this feature, the scripting in subject 7 will be much efficient.

I hope the above information, will give idea on my thoughts, if needed we can have a call to discuss in detail.

Regards,

Yathish

 

0
Comment actions Permalink
Avatar
Rex Feizi

Thank you for your inquiry. I will categorize my response in two folds for easier referencing. 

 

1. The main idea of Subject7 is to allow robust automation without descending to the level of a programming language. The main constructors are there if more advanced users want to use it, but the main idea is to avoid creating yet another language. Naturally, People from the development background will try to find such constructs such as loop and conditionals and parameter passing. However, in Subject7, we try to simplify such constructs by looking at the scenarios in a different way. That being said, should there be a compelling case where the platform has a shortcoming with automating a scenario, we will definalty try to come up with enhancements. 

2. Let me try to explain how I would go about automating your above example with the Subject7 platform. The idea is to create the function with data templates and each time you want to execute the test case that has this function, you will feed it with the desire data sets. Selecting data sets is the platform's way of passing parameters to a function. In your scenario above, you have the locator as a data template field and pass it through a data set. 

If the above answer is not satisfactory, please don't hesitate to mention it and we will explore it further. 

0
Comment actions Permalink

Please sign in to leave a comment.