Changing test from one type to the other on the fly. (Prod/Staging)

6 posts, 0 answers
  1. Caleb
    Caleb avatar
    5 posts
    Member since:
    Nov 2015

    Posted 07 Dec 2015 Link to this post

    Hi, 

    Just wondering, how would I go about being able to change the test type. We've experimented with data driven tests, adding different url's for each row, but as we've discovered this means the test runs multiple times for each environment and runs all steps(which we do not want). Is there a verification process where you can look at the local data and read a value into an if statement? Any efficient way of doing this would be greatly appreciated. 

    Also have experimented with base url, not sure how to differ the actual test though.

     

    Cheers,

    Caleb

  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 08 Dec 2015 Link to this post

    Hi Caleb,

    I'm not sure what you mean by "change the test type". In the world of Test Studio a test type means a web test or a WPF test or a load test or a performance test. Once a test is created it's absolutely impossible to change its type from one to the other in this context.

    Reading the rest of your inquiry it sounds like what you really mean is how do you point a test from one environment to another environment. Such is run the same test on stage versus production versus development. Is that correct? We have this KB article dedicated to how to make your tests run against different environments using our base URL feature. Please go through this article and let me know if you need additional assistance.

    If I've misunderstood your inquiry please let me know.


    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Caleb
    Caleb avatar
    5 posts
    Member since:
    Nov 2015

    Posted 08 Dec 2015 in reply to Cody Link to this post

    Thanks for the quick reply!

    Yes, I was talking about test environment, was mixed up, long day. You understood :) Changing from one environment to another, however, the staging test has processes such as entering data which would not be applicable on the production test. Is there a way to differ the test based on environment other than writing another test?

    We just want to be able to change base URL or use a different row in the local data tab to navigate to each environment, have the test recognize that and disable or skip certain steps.

     

    Regards,

    Caleb

  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 09 Dec 2015 Link to this post

    Hello Caleb,

    Making the test behave differently based upon which environment it is hitting is much more difficult. In general the test should do the exact same thing no matter which environment it is hitting. Test Studio wants to assume that the application is 100% identical no matter which environment it is placed on.

    Test Studio does not support changing the behavior of the test based upon data from the data source using the built-in IF/ELSE block. The IF/ELSE block does work on UI elements displayed in the browser. If there's something different in the UI based upon the environment then Test Studio can detect that and do something different.

    The base URL is how you're supposed to navigate to a different environment. The NavigateTo step will use the base URL setting to control which URL the navigate step will go to. There's no need to put different environments in different rows of the data source.

    If you don't mind writing code we can write code that will look at the data in the data source and do something different based upon that data. Here's a code sample showing you how to read the data from the data source in a coded step. You just need to read the data and use it in and if block in the code. It is also possible to run a subtest from code. Thus, based upon the data in the data source, you can have the test execute a subtest A or subtest B.

    Hopefully this gives you some ideas how to you can structure your tests.

    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  5. Caleb
    Caleb avatar
    5 posts
    Member since:
    Nov 2015

    Posted 17 Dec 2015 in reply to Cody Link to this post

    Hi Cody,

    Ended up removing data changing capabilities of the test so it was able to run across all environments. UI was the same, would have made it difficult. But thanks anyway. Just confirming, there's no function choose which row or iteration to run from the local data table?

    Regards,

    Caleb

  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 17 Dec 2015 Link to this post

    Hello Caleb,

    You are correct. There is no method in Test Studio to control which row or set of rows from the local data table to use when running the test.

    However if you want to get fancy you can implement your own execution extension DLL, specifically the OnInitializeDataSource hook. This hook will get called at the beginning of every single test ever run on that machine. Using this hook you can write whatever code you want to feed whatever data you want to the test based on any criteria you decide to implement in your code. You can use things like an external configuration file and even the name of the test to control what data gets fed to the test. You simply need to return a .NET data table object for the test to use.


    Regards,
    Cody
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top