Hi,
Got several test cases with a iteration of 3 set inside smart folders. Now I would like to enhance some features of this suite but then I need to read the current value of the iteration. Whatever I do I seem only to be able to get the value from the test case, that is always 1. How can I read the current iteration of a smart folder?
BR // Peter S
Read the current Iteration count from a smart folder
-
- Posts: 7
- Joined: Tue Mar 27, 2018 10:29 am
Re: Read the current Iteration count from a smart folder
Hi,
You can use this, in case you are using data connector in given smart folder:
or this, in case the smart folder is using simple "iteration" counter (no attached data connector):
You can use this, in case you are using data connector in given smart folder:
Code: Select all
int currentIterationIndex = TestSuite.Current.GetTestContainer(TestSuite.CurrentTestContainer.Name).DataContext.CurrentRowIndex;
Code: Select all
int currentIterationIndex = Ranorex.Core.Reporting.TestReport.CurrentTestIterationActivity.Index;
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 7
- Joined: Tue Mar 27, 2018 10:29 am
Re: Read the current Iteration count from a smart folder
Hi,
No, I have tried all these but I still only get the result 1. I have assumed it was from the TestCase instead of the smart folder. Anyway, I does not work for a smart folder.
BR // PS
No, I have tried all these but I still only get the result 1. I have assumed it was from the TestCase instead of the smart folder. Anyway, I does not work for a smart folder.
BR // PS
Re: Read the current Iteration count from a smart folder
Hi,
Could you please share your test suite (or create and share a small sample test suite)? From where do you call the code and which one of the two I posted? Is there a data connector in the smart folder?
Could you please share your test suite (or create and share a small sample test suite)? From where do you call the code and which one of the two I posted? Is there a data connector in the smart folder?
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 7
- Joined: Tue Mar 27, 2018 10:29 am
Re: Read the current Iteration count from a smart folder
Hi,
here's the code (in VB.net). Attched a screenshot of the TestSuite hierarchy.
Public Sub TcDescToNoteIfIteration1()
Dim itrname, containerName As String
Dim SmartFolderName As TestSuiteEntryContainer
SmartFolderName = TestSuite.CurrentTestContainer 'dirty one - just to check what node I looking into
'itrname = TestSuite.Current.GetTestContainer(TestSuite.CurrentTestContainer.Name.ToString()).DataContext.CurrentRowIndex.ToString()
containerName=SmartFolderName.Name.ToString()
itrname = TestSuite.Current.CurrentTestContainer.DataContext.CurrentRowIndex.ToString()
'itrname=Ranorex.Core.Reporting.TestReport.CurrentTestIterationActivity.Index
'debug
Note=TCDesc & " debug: " & itrname & " - name of test container: " & containerName 'itrname is always 1 whatever I do
End Sub
here's the code (in VB.net). Attched a screenshot of the TestSuite hierarchy.
Public Sub TcDescToNoteIfIteration1()
Dim itrname, containerName As String
Dim SmartFolderName As TestSuiteEntryContainer
SmartFolderName = TestSuite.CurrentTestContainer 'dirty one - just to check what node I looking into
'itrname = TestSuite.Current.GetTestContainer(TestSuite.CurrentTestContainer.Name.ToString()).DataContext.CurrentRowIndex.ToString()
containerName=SmartFolderName.Name.ToString()
itrname = TestSuite.Current.CurrentTestContainer.DataContext.CurrentRowIndex.ToString()
'itrname=Ranorex.Core.Reporting.TestReport.CurrentTestIterationActivity.Index
'debug
Note=TCDesc & " debug: " & itrname & " - name of test container: " & containerName 'itrname is always 1 whatever I do
End Sub
You do not have the required permissions to view the files attached to this post.
Re: Read the current Iteration count from a smart folder
Hi,
And the code is placed where? In either of the recordings in given smart folder?
And the code is placed where? In either of the recordings in given smart folder?
Last edited by odklizec on Wed Nov 20, 2019 11:45 am, edited 2 times in total.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
- Posts: 7
- Joined: Tue Mar 27, 2018 10:29 am
Re: Read the current Iteration count from a smart folder
The code is placed in the "LoginWithLogging" recording.
Re: Read the current Iteration count from a smart folder
Well, I'm not sure if CurrentTestIterationActivity is still supported as it's an internal API method
The other method, should definitely return actual data connector row index? But I'm not sure how does htis work together with defined SF Iteration count?
Anyway, another solution is described in this post:
https://www.ranorex.com/forum/viewtopic ... 79&#p47879
The other method, should definitely return actual data connector row index? But I'm not sure how does htis work together with defined SF Iteration count?
Anyway, another solution is described in this post:
https://www.ranorex.com/forum/viewtopic ... 79&#p47879
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Read the current Iteration count from a smart folder
how to change or set count iteration of a particular Smartfolder using a code.
Let's say the Smartfolder Count iteration was 4 and now you want to change it to value 1.
Let's say the Smartfolder Count iteration was 4 and now you want to change it to value 1.
Re: Read the current Iteration count from a smart folder
Hi,
I'm afraid, there is no public API for setting the Iteration Count from code. The only thing you can probably do, is to setup the data connector in given smart folder and then change its content via code. Check this post where you can find an example code how to change content of data connector in runtime. All you have to do is to add some lines to the data connector of your choice, which means the smartfolder with associated data connector will repeat as many times as you want...
repeat-a-group-of-recordings-for-a-dyna ... 18667.html
I'm afraid, there is no public API for setting the Iteration Count from code. The only thing you can probably do, is to setup the data connector in given smart folder and then change its content via code. Check this post where you can find an example code how to change content of data connector in runtime. All you have to do is to add some lines to the data connector of your choice, which means the smartfolder with associated data connector will repeat as many times as you want...
repeat-a-group-of-recordings-for-a-dyna ... 18667.html
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration