Dynamic contentText
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dynamic contentText
Hi everyone!
Basically I have these 2 scenarios that I'm trying to run:
✤ Scenario 1: I have to buy a product and select a specific credit card to complete the transaction.
✤ Scenario 2: I have to buy a product and select a credit card different from the first one to complete the transaction.
Note: these 2 credit cards already have been added to my account and the two options are available on my order checkout.
So, what I'm trying to achieve is how can I make my test to dynamically select the correct credit card (without inserting an "if" validation for each Label). I'm also trying to achieve it from Keyword Tests.
Each Label follows the following contentText standard: **** **** **** #. The last 4 digits are the only thing that is different from each credit card.
What I tried to do is included the whole "**** **** **** 8013" in a CSV and tried to set it into a project variable so I could replace the contentText for it, but it didn't work.
Any thoughts?
Regards,
Nidlees.
Solved! Go to Solution.
- Labels:
-
Keyword Tests
-
Name Mapping
-
Scripting
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so it sounds like ultimately, you want a workflow where you can proceed with purchasing the item with various different credit card numbers.
I would suggest creating a csv file with a column header "credit card number" and then filling out the subsequent rows with various different credit card numbers (i.e 1234 5678 9101 8013)
And then using the "make data loop" option, you can data drive your workflow by essentially parameterizing your credit card number value to be entries from your csv file. (https://support.smartbear.com/testcomplete/docs/keyword-testing/basic/data-driven-loops.html)
In the end, what you have is the same workflow where you buy a product, but iterated multiple times over the entries in your csv file, so that you end up testing the purchasing of a product using multiple different credit card numbers.
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure what the error is that you are getting. Are you assigning your value to a temporary project variable or a persistent project variable. They behave differently between multiple runs of the same test.
It may help to explain what the result of your efforts hava been so far. If you are trying to select specific data from your Excel file you may need to use code with the DDT driver instead of simply looping through it in a keyword test...
All about reading Excel data...
There is also a required driver...
https://www.microsoft.com/en-US/download/details.aspx?id=13255
Best of luck!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everyone for the suggestions!
Hi @nidlees , were you able to solve this? Please share the progress with us.
Sonya Mihaljova
Community and Education Specialist
