Ask a Question

Parameterized test step

SOLVED
ryanterronez
Occasional Contributor

Parameterized test step

I have a page that displays links for different charts:

ryanterronez_1-1617825823330.png

I would like to have a parameterized keyword test step that will take each of these links as a parameter.  That way I can write one test and have it run however many times as needed.  I'm not sure how to do this and I'm looking for suggestions.  If possible, I would like to avoid scripting for this.  I'm sure I could come up with some JS that could accomplish this, but I would like a way to do it using a keyword test.

8 REPLIES 8
Marsha_R
Champion Level 3
ryanterronez
Occasional Contributor

@Marsha_R I've looked at this and I run into issues at this step:

ryanterronez_0-1617885102680.png

https://support.smartbear.com.../modifying-mastercard-clickbutton-operation.html 

 

I'm using CSS selectors for name mapping, and I do not see how I can do this step.

Hi @ryanterronez,

 

See if this article helps - section "To use variables in selectors"

https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/xpat...

 

You can use a variable to drive the selector - this could even work in a datadriven loop if thats something you are looking to do.

 

 

 

 

ryanterronez
Occasional Contributor

@ebarbera Thanks!  That is what I was looking for.  I'll give this a go and let you know if it works.

ryanterronez
Occasional Contributor

@ebarbera 

 

I have created a project level table variable named chartCategory:

ryanterronez_0-1617891250117.png

ryanterronez_1-1617891292169.png

I have referenced the variable in name mapping as described here:

ryanterronez_2-1617891344436.png

ryanterronez_3-1617891456288.png

I have tried with and without single quotes, I have tried with and without a column name and I keep getting this error:

ryanterronez_4-1617891519663.png

Not sure what I am doing wrong, but I can't seem to get it to work.

@ryanterronez 

 

I believe the issue here is the variable type - for this you will have to use a string type variable. 

 

You can use a set variable value step to iterate through a table - here is a somewhat similar tutorial that applies a similar concept: https://support.smartbear.com/testcomplete/docs/testing-with/data-driven/tutorials/keyword/modifying...

 

 

ryanterronez
Occasional Contributor

@ebarbera 

 

Alright, I got it working.  Had to change the variable type to string and also had to make it a persistent variable, wasn't working when I had it as a temporary variable.  Thank you so much for you assistance!

@ryanterronez I should have mentioned the persistent part - but I'm glad you got it working! 

 

Happy to help anytime.

 

Emma

cancel
Showing results for 
Search instead for 
Did you mean: