Dynamically setting datasource to testscript...

9 posts, 0 answers
  1. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 04 Sep 2011 Link to this post

    Hi plamen/cody/stoich,

    Good Morning.,

    Can you please help me in identifying the procedure for dynamically setting datasource to test scripts.......

    let me explain you my scenario:
    ----------------------------------------------------------------------------------

    ArtOfTest.WebAii.Design.Execution.TestInfo test1 = new ArtOfTest.WebAii.Design.Execution.TestInfo(Guid.NewGuid().ToString(), @"C:\Users\xxxxx\Documents\Test Studio Projects\IndividualScripts\" + row.Cells[0].Text + ".tstest");
    ArtOfTest.WebAii.Design.Execution.TestInfo test2 = new ArtOfTest.WebAii.Design.Execution.TestInfo(Guid.NewGuid().ToString(), @"C:\Users\xxxxx\Documents\Test Studio Projects\IndividualScripts\" + row.Cells[1].Text + ".tstest");

    ArtOfTest.WebAii.Design.Execution.TestList listcol = new ArtOfTest.WebAii.Design.Execution.TestList("testdatabind", "");
    listcol.Tests.Add(test1);
    listcol.Tests.Add(test2);

    listcol.Settings.Web.RecycleBrowser = true;
    listcol.Settings.UnexpectedDialogAction = ArtOfTest.WebAii.Core.UnexpectedDialogAction.HandleAndContinue;
    listcol.SaveToListFile(@"C:\Users\hvadde\Documents\Test Studio Projects\IndividualScripts");

    System.Diagnostics.ProcessStartInfo psi = new ProcessStartInfo();
     psi.WorkingDirectory = @"C:\Program Files (x86)\Telerik\Test Studio 2011.1\Bin\";
     psi.FileName = "ArtOfTest.Runner.exe";
     psi.UseShellExecute = false;
    psi.Arguments = " list=" + "\"" + @"C:\Users\xxxxx\Documents\Test Studio Projects\IndividualScripts\TestLists\testdatabind.aiilist" + "\"";
     Process p = Process.Start(psi);
     p.WaitForExit();

    ----------------------------------------------------------------------------------------------------------------------

    My current scenario:
    now am binding the datasources(excel files) to individual test sciprts(test1,test2) and adding then as list and executing them by running over command prompt wth artofrunner.exe...code show above...pls chk it...


    My requirement :
    now i need like.....thru code i want to set datasources(excel files) to individual test scripts(test1, test2)...and adding then as list and executing them ...

    can you please tell/help me in identyfing the procedure for dynamically adding datasources to individual test scripts....
    thnaks in advance....

    am involving in the preparing the DEMO of some application using this telerik test studio....
     
    Thanks.,
    Hari

  2. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 06 Sep 2011 Link to this post

    Hello Wish,

    First you can use a non-coded solution as described in this KB article.

    If you really want to use code, you'll need to create your own test extension DLL, as described here, and implement the OnInitializeDataSource method. Remember that your test extension DLL will be called for all tests. You can filter by the name of the test to implement more granular control in your code.

    Kind regards,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  3. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 06 Sep 2011 Link to this post

    Hi Cody,

    Thanks for the immediate response.

    I tried the procedure which you mentioned below, but am nt succesfull...can you please help me by showing or sharing code snippet how to use.

    I did like below...
    Created class library and added to the class the interface ie., IExecutionExtension and implemented the oninitializedatasource method,and builded and placed the dll in plugins folder.

    while executing the test lists, the datasources are not reflected.(Even i could nt able to debug also)..

    can you please help me by sharing or showing code snippet how to use this procedure and also if possible how to debug???

    Thanks in advance...

    Thanks.,
    Hari
  4. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2011 Link to this post

    Hi Cody,

    CAN YOU PLEASE HELP ME BY SUGGESTING TO MY BELOW QUERY ASAP...

    THANKS
    HARI
  5. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 08 Sep 2011 Link to this post

    Hi Wish,

    I apologize for the delay responding (we're temporarily overwhelmed in support). Attached is a sample project showing how to create a test extension DLL and create your own custom datasource to be used by tests.

    Best wishes,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  6. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    Hi Cody,

    Thanks for the immediate reply..

    it worked out for me..thanks alot for ur help..

    one more query....it is going smooth my windows 7 OS....but the same setup is not working well Xp OS...

    is it any OS speciifc???

    for XP os, wil i need to make any chnages???

    please help me on this??

    Thanks.,.
    Hari
  7. Cody
    Admin
    Cody avatar
    3354 posts

    Posted 08 Sep 2011 Link to this post

    Hello Wish,

    No, the implementation is not OS specific. It should work well on XP or above. What is the symptom/error message?

    Regards,
    Cody
    the Telerik team
    Vote for Telerik Test Studio at the Annual Automation Honors Voting!
  8. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    Hi Cody,

    I did it on Windows 7 OS, its went smooth.

    i did the same thing...data is not getting driven on to the test scripts...

    created class library , added interface to the class and implemenetd interface methods and given logic oninitilaize datasource.
    builded it....and dll is placed in following location in XP os machine

    C:\Program Files\Telerik\Test Studio 2011.1\Bin\Plugins


    PFA having the result file after the execution of test script

    Pls help me , if i made a mistake....

    Thanks,
    Hari
  9. wish
    wish avatar
    43 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    Hi Cody,

    The issue got resolved....

    i made a mistake of selecting worksheet name in excel...

    Thanks.,
    Hari
Back to Top