Solved

How to get list of opened workbooks in an Excel 2010 application using Coded UI Tests in Visual Studio 2010?

Posted on 2011-09-19
4
568 Views
Last Modified: 2013-12-13
Hello,

I have created a test project with Visual Studio 2010 Premium to test an Excel 2010 add-in. i'm using Coded UI Tests to automate the testing, and I'd like to get the list of the opened workbooks in a one of the tests.

I was thinking that I could get the names of the opened workbooks from the View->Switch Windows button, as we can see below:
 View-Switch Windows screenshot
But when I track the UI control using the Microsoft UI Test Builder, I don't find how to get the elements of the list displayed when clicking the DropDownButton control:
 Coded UI Test Builder
It would be simpler if I could get it by accessing the excel application object in C#, but I don't know either how to do this, as the application is executed from the UIMap object:
 Launch Excel 2010
Can you please help?
Thanks in advance,
Julien
0
Comment
Question by:JulienVan
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
akoster earned 500 total points
Comment Utility
Regularly I would expect the opened workbooks to be stored in the excel.workbooks object.
I do not know however if this object is available from within the test environment...
0
 
LVL 2

Assisted Solution

by:JulienVan
JulienVan earned 0 total points
Comment Utility
Hi Akoster, the problem came from the fact that I wanted to convert the Excel application object created by the coded ui test editor (type Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinWindow) into a Microsoft.Office.Interop.Excel.Application object.

Thanks to your comment, I tried to create the excel application using a new instance of the class Microsoft.Office.Interop.Excel.Application, and it works fine. I've just replaced the first test step (opening excel) by two lines of code, and I'm an happy man now!

I'm going to close the question, thanks for your help.
0
 
LVL 2

Author Closing Comment

by:JulienVan
Comment Utility
I've added my comment as part of the solution
0
 
LVL 19

Expert Comment

by:akoster
Comment Utility
you're welcome !
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now