This is a migrated thread and some comments may be shown as answers.

Dynamically setting datasource to testscript...

8 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
wish
Top achievements
Rank 1
wish asked on 05 Sep 2011, 03:08 AM
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

8 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 06 Sep 2011, 11:14 PM
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!
0
wish
Top achievements
Rank 1
answered on 07 Sep 2011, 01:36 AM
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
0
wish
Top achievements
Rank 1
answered on 07 Sep 2011, 06:50 PM
Hi Cody,

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

THANKS
HARI
0
Cody
Telerik team
answered on 08 Sep 2011, 04:06 PM
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!
0
wish
Top achievements
Rank 1
answered on 08 Sep 2011, 07:41 PM
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
0
Cody
Telerik team
answered on 08 Sep 2011, 08:54 PM
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!
0
wish
Top achievements
Rank 1
answered on 08 Sep 2011, 09:45 PM
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
0
wish
Top achievements
Rank 1
answered on 08 Sep 2011, 11:20 PM
Hi Cody,

The issue got resolved....

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

Thanks.,
Hari
Tags
General Discussions
Asked by
wish
Top achievements
Rank 1
Answers by
Cody
Telerik team
wish
Top achievements
Rank 1
Share this question
or