Coded step methods with parameter

2 posts, 0 answers
  1. algot
    algot avatar
    57 posts
    Member since:
    Nov 2011

    Posted 11 Apr 2012 Link to this post

    How could I return some parameter from 1 method and use it as input parameter in another method?

    I have 2 methods and need to communicate between them
        [CodedStep("Copy and convert Contact URL")]
        public string Copy_ContactURL()
          // Copy URL of current Contact
          string contactURL = ActiveBrowser.Url.ToString();
          // Convert URL     
          var nameValueCollection = HttpUtility.ParseQueryString(contactURL);
          string[] paramArray = { "preloadcache", "pagemode", "rof", "extraqs" };
          for (int i = 0; i < paramArray.Length; i++)
          contactURL = HttpUtility.UrlDecode(nameValueCollection.ToString());
          return contactURL;
        [CodedStep("Open Contact")]
        public void OpenContact(string contactURL)
  2. Stoich
    Stoich avatar
    1 posts

    Posted 11 Apr 2012 Link to this post

    Hi Alexander,
    coded steps can't be used as a regular function that accepts a parameter and has a return value. Instead, I would suggest to:
    A) Create a Utility class:

    B) Create a static variable inside of the code-behind file (the class that contains your coded steps). Then have the functions write/read this static variable.

    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top