?
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
Medium Priority
?
600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Arno Koster earned 2000 total points
ID: 36567461
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
ID: 36567593
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
ID: 36594679
I've added my comment as part of the solution
0
 
LVL 19

Expert Comment

by:Arno Koster
ID: 36567740
you're welcome !
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

765 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