Creating a NavigateTo with multiple variables

4 posts, 0 answers
  1. Sander
    Sander avatar
    2 posts
    Member since:
    May 2013

    Posted 15 May 2013 Link to this post

    Hi,

    This seems like a common problem, but watching video's and reading other posts hasn't helped me solve it completely.

    1. I want to be able to execute a webtest for 2 baseurl's. (production.xxx.com and stage.xxx.com). I've done this using a baseurl (no problem).

    2. I want to be able to execute the same webtest for different projects:
    Production.xxx.com/projects/1245/bla.aspx
    Production.xxx.com/projects/1248/bla.aspx

    (..by replacing a part of the navigateurl (the projectID))

    I want to test elements of around 50 pages, per project.
    A solution I could think of was also databinding the navigateUrl (/projects/1248/bla.aspx), but that means I have to create 50 records in my datasource for each navigation. So this doesn't seem feasible.

    --> I'm an unexperienced scripter, so I'd love some basic scripting knowledge (How to create a navurl based on multiple variables from a datasource).

    Do you have a different solution, or can you help me script this?

    Kind regards,
    Sander van Mourik
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1072 posts

    Posted 15 May 2013 Link to this post

    Hi Sander,

    Unfortunately you need to change the URL/BaseURL every time you want to execute on a different server/page.

    An option is to data bind the navigate URL as you mentioned.

    Please read more about data binding here and how to achieve it.

    Also please check out how to run a Test Against Multiple Environments.

    Hope this helps.

    All the best,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Sander
    Sander avatar
    2 posts
    Member since:
    May 2013

    Posted 15 May 2013 Link to this post

    Hi Boyan,

    Thanks for your quick reply.

    It doesn't really help as I'll have to add every single navigation url to my datasource, resulting in a huge file and making my test less maintainable.
    What i'm looking for is a line of script which basically does;
    NavigateTo a URL consisting of [baseurl (from datasource)] /projects/ [projectid (from datasource)] /somepage/bla.aspx

    Resulting in navigation to
    http://production.xxx.com/projects/1245/somepage/bla.aspx

    Basically what this user is explaining in her first post. I just can't get that piece of script to run.
    Can you provide an example of this?

    Regards,
    Sander
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1072 posts

    Posted 15 May 2013 Link to this post

    Hi Sander,

    If you want data bind different parts of the url this should be done in a coded step:

    ActiveBrowser.NavigateTo("http://" + Data["BaseURL"] + "/project/" + Data["ProjectID"],  true);

    Here is the video with the entire process from scratch.

    Let me know if you need further assistance.

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