how to loop all recordings

Class library usage, coding and language questions.
Posts: 16
Joined: Wed Mar 31, 2010 7:45 am

how to loop all recordings

Post by Liam » Fri Jun 25, 2010 9:20 am

beginner to programming, so maybe a stupid question, but...

I am organizing my testing cases this way:
toRanorex.png (5.1 KiB) Viewed 1618 times
Considering that more and more recordings will be added to the "cases" folder, is there some method I can use in Program.cs to auto-loop and run all existing recordings in that folder?
For now after a new recording is added, I have to manually add something like: "recording_x.Start(); ", and this is making the Program.cs longer and longer...

thanks in advance :)

P.S. maybe my organization of testing cases is not good... could someone be nice to recommend a good way to organize the testing cases?

User avatar
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: how to loop all recordings

Post by sdaly » Fri Jun 25, 2010 4:27 pm

Hi Liam

Try this -

Imports System.IO
Imports System.Reflection

Dim files As string()
files = directory.GetFiles(application.StartupPath & "\..\..")
For Each item As String In files
Dim name as String = path.GetFileName(item)
If right(name,5) = "rxrec" Then
Dim t As Type
Dim m as Reflection.MethodInfo
Dim a as Reflection.Assembly = reflection.Assembly.GetExecutingAssembly
For Each t In a.GetTypes
If t.Name = left(name,name.Length-6) Then
For Each m In t.GetMethods
If m.Name = "Start" Then
Dim g as New object
End If
End If
End If

Let me know if it works for you! :)


Posts: 16
Joined: Wed Mar 31, 2010 7:45 am

Re: how to loop all recordings

Post by Liam » Mon Jun 28, 2010 9:16 am

Hi Scott,

Thank you very much for your help! I read your sample and converted it to C# (learning this language :) ) -- it's working pretty good!