To print PASS/FAIL status in excel , after coded UI tests - coded-ui-tests

I am using Coded UI for testing.
I have a set of 5 fields to be validated in one page.
I have added assert and record methods and all that is working fine.
Is it possible to import an excel file with field level validations and mark Pass/Fail status in that excel sheet through Coded UI?
Like, the test result should be printed in the last column of the excel sheet across each of the fields.
Is that possible?

Yes it is possible.
Here's how to read from excel:
http://msdn.microsoft.com/en-us/library/ee624082.aspx
And here are some links to help write to excel:
Writing to an existing Excel File using c#
http://msdn.microsoft.com/en-us/library/dd264733.aspx
http://www.codeproject.com/Tips/613782/Read-and-Write-Excel-File-Dynamically

Related

Copy and paste Excel rows between two workbooks based on criteria from exported Access data

I have no previous experience in Access, VBA coding or in Excel macros prior to teaching myself the past month via these forums. Thank you forums and contributors. I have enjoyed my Access learnings so far, the challenge that it has provided and appreciate any help that I can get. As such, the code and methods that I have used to this point may well be convoluted and confusing. I will do my best to provide relevant details and accurate terminology.
I work in a lab and I am creating an Access Form for semi-automated reporting. Samples are received from clients and are logged into the Excel Table R&D Log. The worksheet is InProcess. Samples are sorted based on the site in which they originate and given a one or two letter site code (G, D, WH, etc.) and an ID "yy-000" in separate Excel columns (i.e. D 18-096). Samples may be submitted for multiple analyses (Metals, Water, Soil, etc.) and may even have multiple rows of reporting if multiple analytes are identified in the sample. There are several other columns, such as receipt date, reporting date, units, etc. Once samples are reported, I manually copy and paste them into the Archived worksheet, and delete the record and blank row from the InProcess worksheet. Since one sample may have multiple analyses and even more potential results, each record would be reported on a new Excel row (with the same D 18-096 ID number). Thus, there is not a single unique identifier or primary key for each sample in the current format. R&D Log is updated manually by lab technicians and the worksheet InProcess is a linked table in an Access Database.
The Access Database is using two combo boxes on a Form frmInProcess to filter a Query qryInProcess of the linked table. The combo boxes are filtering the report destination (one client may receive multiple site codes) and the analysis (reports are separated based on type of analysis). The Query is also filtering out blank results and blank dates, so only completed samples will appear on the filtered Form. I have generated VBA code to this point that will export the Form to a .pdf, save the file with unique filename, and open outlook to mail out the report. I have also managed to export the filtered Form frmInProcess to an Excel file Access Test (not the linked file).
What I would like to do now is to automate the transfer of completed test results from the Excel worksheet R&D Log: InProcess to R&D Log: Archived and delete the record from the InProcess worksheet. I am not sure if I can export the filtered Form into a linked Excel table, or if I must use a separate Excel file (or if it even matters for simplicity of code?). I would now like to read the exported filtered Form in Excel Access Test, lookup matching rows in R&D Log based on several criteria (site, ID, Analysis, Analyte, Report Date) and automate the transfer of records between R&D Log worksheets. End result being that Access generates reports for completed tests, and the records are removed from InProcess testing and transferred to Archived testing in Excel. I am guessing that I may need to close the Access application and perform this in Excel. Hope this is easy enough to follow.
Thank you.
In my experience, importing an Excel document into a temporary NEW (or totally empty) Access table is usually the easiest way to go. Then you do not have to worry about cell references like you do in Excel VBA. Even if the Excel document has old data in it with just a few new changes each time, importing it into a temporary Access table could be the simplest way to go, because then you can compare the data in this table with the data in another, permanent Access table and update the latter based on the former.
As far as the original Excel file, if you need to delete rows there, it might be quicker to export a new Excel file with just the data the old one is supposed to end up with, and then use VBA to delete (or - safer! - rename) the old file.
So the development process goes something like this:
Save import steps by first importing an Excel file via Access' ribbon options "External Data" (tab) ->"Excel" and when you finish, be sure to check the "Save import steps" box and note the name you give the "saved import" because you will need that in your VBA code.
In Access, write a function for deleting the table. The VBA code is:
Const cTable = "MyExcelTempTable"
If TableExists(cTable) Then
DoCmd.DeleteObject acTable, cTable
End If
Now you can test your delete function on the data you imported.
Write VBA code to import the same spreadsheet to create the same table:
Const cSavedImport = "Import-MyExcelTempTable"
' Import the Excel file
DoCmd.RunSavedImportExport cSavedImport
Write more VBA function(s) to check the imported table for bad data and then to copy it into the permanent table. You might be updating existing records or adding new ones. Either way, you could use Access queries or SQL to do this and run them from VBA.
Write a VBA function to rename the old Excel file. (You could use an InputBox if the Excel file name is different each time. I do this for importing Excel files, and I set a default value so I do not have to type as much.)
Write a VBA function to export the new version of the Excel file.
Make yourself a button on a form that, when clicked, runs a VBA function. Inside that function, run Steps 2 through 6, above.
I am not sure my answer exactly matches what you are trying to do, but hopefully you get enough of a picture of the workflow to figure out the details of what you need.

Creating rtf template with multi spreadsheets(excel)

I have created a data template report(xdodtexe) and the output will be in excel with multiple spread sheets. My E-Business Suite version is r12.1.3 and I am using Office 2013.
I have created an rtf and in two separate pages layouts are there. For example department in page and employees in page. I am using <?spreadsheet-sheet-name: department?> for naming the sheets but the sheet name comes as "fndwrr" and both the outputs are in the same excel sheet without splitting into two different sheets.
I have also used <?split-by-page-break:?> for splitting into two sheets but this also does not work.
Hello there fellow "BI Publisher self-torturer" :-),
First of all, I would suggest you go over this document here, as the best method of manipulating XLS outputs is by using Excel templates.
Second of all - it would have been great if you supply a sample of the xml data + a sample of the template code as you have it.
Btw, the split-by-page-break that you're trying is for other output formats, such as PDF, RTF etc. which follow a paging rule, unlike XLS.
This being said - I am pretty sure you can't do that using an RTF template.
Also, you should mention the version of the XDO Engine/BI Publisher, because Excel templates are available since version 11.1.15 of BI Publisher.
Pay special attention to the following section Table 3-2 Column Entries, as you would need to put the XDO_SHEET_? and XDO_SHEET_NAME_?, the first being the split/group criteria and the second the actual name of the sheet.
Cheers

Using a Script to hide rows in excel spreadsheet

I have the following script in an Excel cell. I'm assuming this is a vba script.
{ if (value == "") {hideRow("34");Text_Boiler_Location(2)}
I've done some research and I'm not sure how to hide the active row without hardcoding the row id. I'm using a form building application that I can build custom reports. However if I change the form then it will throw of the row id in the script. I will many of these little scripts and I do not want to change the row id every time I change the form. So basically I just need to hide the active row if the value is an empty string without hardcoding it.
Can try below
ActiveCell.EntireRow.Hidden=True
This is neither vb or vba. It is a script created by the form application I use. They do not have the ability at this time to identify the active row. It has to be hard coded. Thanks for everyone's response.

Updating OneNote from VBA Excel

I'm trying to automate the addition of a link to a report in OneNote. Basically, I have a already running macro producing a daily report in VBA Excel and saving a values only copy in a given folder. I would now like to add to the code so that an hyperlink is created in OneNote so the end-user may access the values-only file by cliking on that hyperlink.
I've found a piece of VBA code that creates a new page in a Notebook on Microsoft webpage: Create New Page
I have modified the code so that it'll go to the Notebook, Section and then Page I tell it to. Then I can have VBA it fetch back the PageContent through XML format.
Now here's the thing: I have a table for the month that starts only with one line two columns ie. the headers (report date and link). Now everyday, I wish to add a line to that table before writing the day's date and the link.
How would I do that in OneNote with VBA Excel ? Is it possible ? Or would I need to change to VB or C# to be able to use Office-InterOp to do so??
If I manage to create an extra line, I think I'd have no problem finding the two empty cells and writing the date and an hyperlink.
Can someone please help?
thanks
Sebastien
After you get the page content in XML format, you just need to modify it to include the Table (or add new rows/cells to it and then call UpdatePageContent. Here is a sample page XML that has a simple Table:
<one:Page xmlns:one="http://schemas.microsoft.com/office/onenote/2010/onenote">
<one:Outline>
<one:OEChildren>
<one:OE>
<one:Table>
<one:Row>
<one:Cell>
<one:OEChildren>
<one:OE><one:T><![CDATA[Cell1]]></one:T></one:OE>
</one:OEChildren>
</one:Cell>
<one:Cell>
<one:OEChildren>
<one:OE><one:T><![CDATA[Cell2]]></one:T></one:OE>
</one:OEChildren>
</one:Cell>
</one:Row>
<one:Row>
<one:Cell>
<one:OEChildren>
<one:OE><one:T><![CDATA[Cell3]]></one:T></one:OE>
</one:OEChildren>
</one:Cell>
<one:Cell>
<one:OEChildren>
<one:OE><one:T><![CDATA[Cell4]]></one:T></one:OE>
</one:OEChildren>
</one:Cell>
</one:Row>
</one:Table>
</one:OE>
</one:OEChildren>
</one:Outline>
</one:Page>

Format Excel while exporting through SSRS

Hi I'm working with SSRS reports.
While exporting the results to excel, results are starting from first column it self. But I want to provide some space for that. (i.e. insteated of starting from 1st column can we start it from 3rd or 4th column ? So that we can have some space)
Thank you
If you intend to distribute the Excel version via a subscription and want a separate view on the report Report Manager, then you can create a parameter for the report like Hide_Columns and make the visibility of the column be dependent upon the value of the parameter. If you want the user to run the report in the HTML view and want the extra columns to show up in Excel, then you are out of luck.

Resources