x
login Signup

Is there a way to tell which procedures use a sub-procedure

I am updating a procedure (A) and know it is being called from at least 2 other projects. Is there a way to determine all of the other procedures that use (A) as a sub-procedure?

avatar image By aorr 17 asked Apr 15 at 12:43 PM
more ▼
(comments are locked)
10|750 characters needed characters left

2 answers: sort voted first

There are a couple of ways to do that:

  • with DSL, it's a matter for looking for "subprocedure: 'NAMEOFSUB'" or something like that. Of course it requires you to follow best-practices and have your code in DSL saved in your SCM.

  • you can also export all your code with EC-Admin::saveAllObjects. It will export all objects either in XML or DSL format, then you can simply search (with grep for example) for the name of your subprocedure (in XML it should be <subprocedure>XXXX</subprocedure> from memory)

  • Finally, you can simply write a "crawler", that would look for each task/step and look for a subprocedure attribute with the name of your sub-procedure. Obviously this is . more work

avatar image By lrochette 5.9k answered Apr 15 at 02:08 PM
more ▼
(comments are locked)
avatar image aorr Apr 15 at 02:13 PM

Thank you for the quick response. I was thinking along the lines of the first and third answers but we don't have our projects in DSL, and I was hoping their was an easier way. I didn't know the second option existed. I think I will try it.

Much appreciated.

10|750 characters needed characters left

Your projects don't have the be in DSL to use option #1. Here, DSL is just a convenient way of accessing the Flow API through Groovy. For example, the follow DSL code will find all the subprocedure calls made from the "Electric Cloud" and "Default" project procedures:

 def ProceduresFound = []
 def ProjectsToSearch = ["Electric Cloud", "Default"]
 ProjectsToSearch.each { proj ->
   getProcedures(projectName: proj).each { proc ->
     def steps = getSteps(projectName: proj, procedureName: proc.procedureName)
     steps.each { step ->
       if (step?.subprocedure) {ProceduresFound.push([step.subproject, step.subprocedure])}
     }
   }
 }
 ProceduresFound

avatar image By gregm 2k answered Apr 15 at 07:23 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.