Autotests: how to catch, verify and close Excel window

Maria-S
Member Posts: 90
Dear Experts,
In my test codeunit I am running the report which produces and opens the excel worksheet.
I need to check the values in the produced excel and close the window.
Can anyone give me directions how to achieve this?
NAV2013R2
I guess it should be done using DotNet (in which I am not so experienced unfortunately).
What I've done:
I found the following piece of C# code:
Now when I try to define the DotNet variable, I go to Assembly List, on the .NET tab I scroll to System.Runtime.InteropServices and select it. Now I expect that there will be list of Types, including Marshall, but the list is empty. Here I stuck.
Can anyone push me to the correct direction?
In my test codeunit I am running the report which produces and opens the excel worksheet.
I need to check the values in the produced excel and close the window.
Can anyone give me directions how to achieve this?
NAV2013R2
I guess it should be done using DotNet (in which I am not so experienced unfortunately).
What I've done:
I found the following piece of C# code:
instance = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");And I want to call same from NAV.
Now when I try to define the DotNet variable, I go to Assembly List, on the .NET tab I scroll to System.Runtime.InteropServices and select it. Now I expect that there will be list of Types, including Marshall, but the list is empty. Here I stuck.
Can anyone push me to the correct direction?
0
Answers
-
You could look into the code that is in table 370 in NAV - there is a lot of code there to open/read/write Excel workbooksJan Veenendaal0
-
Hi Jan,
No-no, you see, I create AutoTest for the functionality that creates excel files (using table370). So from test point of view I am running the report programmatically, and then I need to verify whether the report creates an excel file.
My problem is that report generates the excel in temporary folder and opens it.
Otherwise I would check that excel file exists in the folder.
But now I need to check that opened excel file exists... and preferrably close it.
Anyway, at this stage we decided to skip such export scenarios (we consider them untestable for now).0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions