Forum Discussion

ibeard's avatar
ibeard
Occasional Contributor
9 years ago

Hide script functions from keyword tests

I have a script with several functions and subfunctions. Some of the functions are called from KeywordTests, but others are just called from those functions. Is there any way to hide the subfunctions from the "Select Test" window when adding the script to a KeywordTest?

 

Current list:

 

 

Desired list: (edited with MSPaint)

 

Thank you

  • Thanks cunderw. While this approach didn't exactly work in python, I used a class to essentially do the same thing.

     

    class Global:
        def hiddenFunction():
              //code
    
    def visibleFunction():
        Global.hiddenFunction()
        //code
  • cunderw's avatar
    cunderw
    Community Hero

    There are a couple ways you could do this actually if using javascript.

     

    One is by using javascript objects / constructors that contain the functions you need;

     

    function foo() {
       this.bar = function() {
          //code
      }
    }

    You can also create your function as a variable in the script unit

     

    var bar = function() {
      //code
    
    }

    In both cases the function bar would not be accesible in a KWT.

    • ibeard's avatar
      ibeard
      Occasional Contributor

      Thanks cunderw. While this approach didn't exactly work in python, I used a class to essentially do the same thing.

       

      class Global:
          def hiddenFunction():
                //code
      
      def visibleFunction():
          Global.hiddenFunction()
          //code