Is there a way to Output 'Extent Report Results' to a Unique Directory? - junit

Is there a way to Output 'Extent Report Results' to a Unique Directory?
For example lets say i execute the my Cucumber framework for the first time > a output folder will be created with the relevant html report as listed:
But is there a way to output a unique folder of the unique report captured at the time of execution, something in the lines of:
I have the following Extent config:
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>
<encoding>UTF-8</encoding>
<documentTitle>Cucumber Extent Reports - v3.0.5</documentTitle>
<reportName>Automation Framework Cucumber Report</reportName>
<reportHeadline> - v3.0.5</reportHeadline>
</configuration>
</extentreports>

Use the appropriate constructor of ExtentHtmlReporter...
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(OUTPUT_FOLDER + FILE_NAME);
Set up folder name to whatever you desire.

Related

Create a pipe delimited, double quote qualified csv file using SSRS?

I need to create a scheduled daily report in csv format with pipe separators and double quote text qualifiers. The data is taken from a Microsoft SQL view. I have been attempting to do this with SSRS and created a custom extension which i had hoped would do the job -
<Extension Name="CSVPIPE" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
<OverrideNames>
<Name Language="en-US">CSV (Pipe delimited)</Name>
</OverrideNames>
<Configuration>
<DeviceInfo>
<FieldDelimiter>|</FieldDelimiter>
<Qualifier>"</Qualifier>
<FieldDelimiter xml:space="preserve"> </FieldDelimiter>
<Encoding>ASCII</Encoding>
</DeviceInfo>
</Configuration>
</Extension>
Unfortunately this does not add the "text qualifier" to the file so I looked at a number of ways to try and either fix this in SSRS or change the file created by SSRS retrospectively. What seemed like such a simple task has proved far more challenging than I anticipated and after many wasted hours, my tether has reached it's end. Any help or suggestions appreciated.

Export stored procedure result set to Excel in SSMS

i'm using SSMS and attempting to export the results of a stored procedure to a new excel file. The SP accepts an int parameter but I cannot find a way to call it in the query.
Latest effort-
EXEC sp_makewebtask
#outputfile = 'C:\Users\me\Documents\testing.xls',
#query = **ExportAsExcel** N'#id' = 123
#colheaders =1,
#FixedFont=0,#lastupdated=0,#resultstitle='Testing details'
Running the stored procedure results in two tables of data, which I need on separate sheets. Can any of you advise a better way to go about this? It doesn't even need to be automated, I just need to get the correct data. The sp name is bolded above.
Thanks for your time,
H
I suggest you split your stored procedure into two procedures that each respectively return a separate table and have those called to different worksheets.
There are a variety of ways to return data to Excel using SQL
Here is a favourite of mine from code by Joshua (you don't have to use the parameters):
Select the Data tab on Excel's Ribbon, then within the Get Exernal Data group choose the "From other Sources" drop-down. Then Choose "From Microsoft Query"
Within "Choose Data Source" pop-up box, select your SQL Server, then hit OK.
Close the "Add Tables" popup if necessary.
Click on the "SQL" button, or choose View > SQL to open the SQL pop-up editor.
Enter the following syntax: {CALL myDatabaseName.dbo.myStoredProc (?, ?, ?)}
For example: {CALL northwind.dbo.spGetMaxCost (?, ?, ?)}
Be sure to include the squiggly braces around the call statement. Each Question Mark (?) indicates a parameter. If your stored procedure calls for more or less parameters, add or subtract question marks as needed.
Hit the OK button. A question box should pop-up saying "SQL Query can't be represented graphically, continue anyway?", just hit the OK button.
You will now be asked for sample parameters for each question mark you included above. Enter valid parameter values for the data you are querying.
Once you have entered the last parameter, you should get some results back in Microsoft Query. If they look good, close Microsoft Query.
You should now be looking at an "Import Data" pop-up. Click the Properties button, which will bring up the "Connection Properties" pop-up.
Select the Definition tab, then select the Parameters button. You should now see a "Parameters" pop-up, where you can connect the parameter to a specific cell.
Select Get the value from the following cell, and then connect to an appropriate cell in Excel that will hold your parameter, by clicking the little box with the arrow.
If you want the data to refresh every time you change the cell containing the parameter, check the box stating "Refresh automatically when cell value changes"
Continue as above for the other parameters. When finished, click OK, to return to the Connection Properties pop-up. Click OK to return to the Import Data pop-up, and click OK again.
You should now have some data straight from your stored procedure.
You will end up with connection information similar to:
Connection info
And, if you use parameters from sheet then, for my example,
This isn't a direct answer to your question, but it is possible using Excel VBA and connections to connect to a SQL Server Stored Procedure, feed it parameters, and return the SP result set in Excel. Check out my article Microsoft Excel & SQL Server: Self service BI to give users the data they want for an image and code-heavy demo.
Good luck.
There's too much detail there to post in a single SO question, otherwise I'd do that here.
I develop SSMSBoost add-in and we have implemented the functionality, that allows you to export data to excel in 3 ways (including creation of several worksheets in one file):
You can export all result grids in one operation to "open worksheet" file format, which excel understands and displays correctly. This file format supports multiple worksheets.
to use it: right-click the data grid in SSMS and select "Script grid data"-> "Excel" template->All Grids->ToDisk.
You can also look inside the generated files to understand how it works. You can then implement same functionality in your stored procedure if you want to stay independent of add-ins. Sample XML is also provided below. (2 excel sheets with 1 column name and 1 value)
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
</ExcelWorkbook>
<Styles>
<Style ss:ID="sH1"><Font ss:Bold="1"/></Style>
<Style ss:ID="sD1"><NumberFormat ss:Format="General Date"/></Style>
<Style ss:ID="sD2"><NumberFormat ss:Format="Short Date"/></Style>
<Style ss:ID="sD3"><NumberFormat ss:Format="Short Time"/></Style>
</Styles>
<Worksheet ss:Name="GridResults1">
<Table>
<Row>
<Cell ss:StyleID="sH1"><Data ss:Type="String">ColumnNameA</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
</Row>
</Table>
</Worksheet>
<Worksheet ss:Name="GridResults2">
<Table>
<Row>
<Cell ss:StyleID="sH1"><Data ss:Type="String">ColumnNameB</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="Number">1</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
You can also copy-paste data from SSMS Grid, right-clicking it and choosing "Copy selection as XML Spreadsheet (Excel)". Data will be copied preserving data types.
More advanced option is our "Post execution handlers" functionality. It allows you to run certain actions after query execution completes. You can schedule automatic export to excel file here as well.
Hope this helps, with, or without SSMSBoost ;)

how to get modified csv file while TestNG test suite is in progress

I am running a test suite in which testNG.xml looks like below:
<suite>
<test name="createFlow">
<classes>
<class name="createReservation">
</class>
</classes>
</test>
<test name="modifyFlow">
<classes>
<class name="modifyReservation">
</class>
</classes>
</test>
The parameters for creating the reservation are being taken from a reservation.csv. Once reservation gets created, reservation ID is stored in that csv,ie. it overrides the value of ID already present there, which is used for modifying that particular reservation, code of which is written in modifyReservation.java.
The problem i am facing is once i run the test suite, the modify flow doesn't fetch the recent reservation ID which is just created in reservation flow from csv, but it takes the ID which was earlier mentioned in the csv.
Please suggest what changes should i make so that in same suite, during the execution is going on, i am able to fetch the updated IDs.
In the file, you have read and write methods for reading/writing data in the csv file, use local variables in every method instead of global variables.
Create new object of FileInputStream and FileOutputStream in each and every method.
FileInputStream fis = new FileInputStream(csvFilePath);
Hope it will work
This is a perfect reason why databases were developed.
Create a new MongoDB or MySQL DB first.
Then create tables and columns based on your data needs.
Write a select query to get data from those tables.
You will avoid all sorts of permissions, locking, refresh etc issues by using databases.

.ImportXML command erring out in MS Access

I am using the following code to try to import an XML file to Access:
my_file = "c:\temp\projects.xml"
Application.ImportXML (my_file)
At some point on the second line I get an error 31550, "Not all of your data was successfully imported. Error descriptions with associated row numbers of bad records can be found in the Microsoft Access table 'ImportErrors'."
I have to End or Debug, and independent of what I choose, the ImportErrors table does not appear in Access. Is there some additional code needed to allow the table to be created? (I had On Error Resume Next in there, and that doesn't help.)
Also, if this did work, where would the XML data be loaded? Does Access create a new table?
where would the XML data be loaded? Does Access create a new table?
That depends on the value of the second (optional) ImportOptions argument. It can be one of
acAppendData
acStructureAndData (the default)
acStructureOnly
So for an XML file like this
<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
<foo>
<FirstName>Gord</FirstName>
<LastName>Thompson</LastName>
</foo>
<foo>
<FirstName>Anne</FirstName>
<LastName>Elk</LastName>
</foo>
</dataroot>
the VBA statement
Application.ImportXML "C:\Users\Gord\Desktop\foo.xml"
will create and populate a new table named [foo] (or [foo1] if a table named [foo] already exists), and the command
Application.ImportXML "C:\Users\Gord\Desktop\foo.xml", acAppendData
will attempt to append the data in the XML file to an existing table named [foo].

SSIS and xml - xml source task output doesn't show all the nodes/columns

I have a complicated xml doc that i'm trying to load to sql db through SSIS. XML source output doesn't show all the columns/nodes. It's like root nodes are ignored.
I have tried following posts that are talking about xml task and xlst without winning.
I can only see columns under Wagons tag. Sender,Receiver, ManagerType, TrainNumber, TrainType,Origin,Destination,etc don't appear as columns output.
I'm trying to upload a sample