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

Data extraction & Dynamic data binding during run-time

14 Answers 291 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yogi
Top achievements
Rank 1
Yogi asked on 13 Dec 2010, 12:55 PM
I have an application which will use the data from an Excel file which will be dynamically generated during execution.
I need to know,
1. How to extract data from the application and export it to an external excel sheet
2. Is there any option to bind an external Excel file during execution

Regards,
Yogi

14 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 13 Dec 2010, 11:32 PM
Hi Yoganand,

You can get the text of most elements using code something like this:

Pages.Bing.SbFormQText.Text;

To write into an Excel file you will have to implement your own code. WebUI does not include any API's for reading/writing to Excel files from your own coded steps. Here's a Microsoft article describing one possible approach.

Can you give us more details about what you're trying to accomplish with binding an external Excel file during execution? Currently there is no built-in feature to do this, but there are a couple of possible tricks we can show you, depending on what exactly you are trying to accomplish.


Regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Yogi
Top achievements
Rank 1
answered on 14 Dec 2010, 02:36 AM
Hi Cody,

Thanks for your response.
I'll give a try the steps specified in the Microsoft article and let you know.

In our application, based on the initial input, the application will generate an unique excel file which contains some data that needs to be feed to the application to perform an action. So it will be better if there is a technique or code to bind the excel sheet during run-time. This will help us to run the test without manual intervention.

Regards,
Yogi
0
Cody
Telerik team
answered on 14 Dec 2010, 04:39 AM
Hello Yoganand,

Attached is a sample test of one of the tricks we can do. Basically a single test can only be bound to one specific data source/file. But what the attached test project does is split the testing into two parts, a main test and a sub test.

  • The main test is data driven and gets its input from a single excel file. It dynamically swaps out the file that the subtest is bound to just before calling the subtest.
  • The subtest is bound to one specific file. When it gets control it opens and begins reading from the file that the main test put there for it to read.
Using this trick you can probably do what you're after.

Regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Yogi
Top achievements
Rank 1
answered on 15 Dec 2010, 12:02 PM
Hello Cody,

Thanks for your support. Given trick works only if the sub test is using a static file name.
I found out a method in MSDN forum to bind excel data source during run-time.

<DataSource("System.Data.Odbc",
"Dsn=Excel Files;dbq=C:\\POC\\Data\\testdata.xls;defaultdir=.;driverid=1046;maxbuffersize=2048;pagetimeout=5",
"Login$",
DataAccessMethod.Sequential)>
<TestMethod()>
Public Sub WebAiiTest1()
    Dim row = TestContext.DataRow.Table.Rows(1)
    Dim actual = row("col2")
    MsgBox(actual)
End Sub

The above code is working fine. But I'm unable to control the iteration, i.e, if the excel sheet has 10 rows, then the test is executed for 10 times.
Please let me know is there any method or trick to control the iteration by specifying a particular row to execute.

Thanks,
Yogi
0
Cody
Telerik team
answered on 15 Dec 2010, 09:25 PM
Hello Yogi,

The code you have posted does work well for a coded unit test. However keep in mind that WebAii tests (i.e. .aii tests) are not coded unit tests. They do not honor the DataSource attribute the way coded unit tests do.

Unfortunately you cannot programmatically control which row or rows of data will be used from the data source. The best we can do is to apply row filtering during the data binding setup as shown in the attached screenshot.

Regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Veera
Top achievements
Rank 1
answered on 20 Dec 2010, 09:11 PM
Hi Cody,
Is there any chance that we can get this feature of controling the iteration in any of the future releases of telerik? This feature is really needed for us.  Pls let us know.. Thanks!!!!

Thanks,
Veera
0
Cody
Telerik team
answered on 20 Dec 2010, 11:34 PM
Hello Veeraraghavan,

I have entered feature request 102982 for this. I cannot specify when (or even if) we'll be able to implement this in a future version. All I can say is that it will be considered by our product manager.

Can you explain to me your business case why you need this? This will help our product manager better understand why this such an important feature to you.

Best wishes,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Veera
Top achievements
Rank 1
answered on 21 Dec 2010, 10:55 PM
This feature is required inorder to change multiple data worksheet for a same script. Currently our application Has different modules that has data inputs . Each module has seperate worksheet in a single excel. As long as the module did not intereacting with one another we do not have issues. If the modules interact then we have problem.
This feature is required as we can Dynamically associate the excel file to the test scripts when required!!!

Hope this helps!!

Thanks,
Veera
0
Cody
Telerik team
answered on 22 Dec 2010, 12:08 AM
Hi Veeraraghavan,

Thank you for the additional information. I've passed it along to the product manager.

I would like to better understand this module interaction that you talk about. From the very limited understanding I have of your application and testing needs, it would seem you would have a set of test cases and one separate test per test case, possibly one for each module, and each test case for a module would be data bound to one sheet from your Excel file.

I'm pretty sure this is for the case of "As long as the module did not intereacting with one another" as you talk about. I am not yet fully understanding how dynamic data binding helps testing with your module interaction.

Greetings,
Cody
the Telerik team

Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Veera
Top achievements
Rank 1
answered on 22 Dec 2010, 07:47 PM
Hi Cody,
Thanks, think at least I made justice this time in my explanation.
We have module like
  • Entity
  • Personnel
  • Contact Etc
Each module interacts with one another by associating a entity with Personnel, Contact etc... We do verification of contacts in entity module and vice-versa ....Same Verification needs to be extended for Personnel, entity.
Currently, we have worksheet per module. If I have to verify the entities details in contact module, we are not able achieve that as both entity details and contact details are from diff worksheet and both info are required in order to complete the verification. which is not possible at this moment!

Hope this helps!!!
0
Cody
Telerik team
answered on 27 Dec 2010, 06:07 PM
Hi Yogi,

Thank you for the clarification. I think I begin to understand your test case now. Based on which Personnel you associate with an Entity you want the same type of test to run, but with different data that goes along with that Personnel record. Do I understand better now?

All the best,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Veera
Top achievements
Rank 1
answered on 28 Dec 2010, 10:41 PM

Hi Cody,

Only one which I would like to highlight here is There will not be one to one mapping between Personnel and Entity.  One Personnel to Multiple entities and One Entity to Multiple Personnel. Hope this helps

Thanks,
Veera

0
Veera
Top achievements
Rank 1
answered on 04 Jan 2011, 08:04 PM
Yes.  Correct!!!
0
Cody
Telerik team
answered on 04 Jan 2011, 10:25 PM
Hello Yogi,

Thanks! I am pretty sure I understand your business needs now.

Kind regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Yogi
Top achievements
Rank 1
Answers by
Cody
Telerik team
Yogi
Top achievements
Rank 1
Veera
Top achievements
Rank 1
Share this question
or