Extent Report with Cucumber generate name with date format - java

I use Extent Report with Cucumber and I can generate test reports as well. But I want to generate test report's name with date format like report-27-01-23.
I can change basefolder name in extent.properties but I can not change file name.
How can I do that in my properties file? Here is my properties file.
extent.reporter.spark.start=true
basefolder.name=test-output/reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
extent.reporter.html.config=src/test/resources/extent-config.xml
extent.reporter.spark.out=d-MMM-YY HH-mm-ss.html
screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/
extent.reporter.spark.vieworder=dashboard,test,exception,author,device,log

Related

How can we generate Handlebars file with html tags and data?

We are using hbs(handlebars) formatted template on the backend side of the project for generate pdf file. What I want is this. Is there an option to create the hbs file with the data in it when the file is created? For example the hbs file in the following should be like this:
hbs before creation
<h4>address1:{{address1}}</h4>
<h4>address2:{{address2}}</h4>
<h4>city:{{city}}</h4>
<h4>state :{{state}}</h4>
hbs after creation
<h4>address1:value</h4>
<h4>address2:value</h4>
<h4>city:value</h4>
<h4>state :value</h4>

How can I write gerrit.config format?

File gerrit.config
The audit configuration can be defined in the main gerrit.config
in a specific section dedicated to the audit-sl4j plugin.
gerrit.audit-sl4j.format
: Output format of the audit record. Can be set to either JSON
or CSV. By default, CSV.
gerrit.audit-sl4j.logName
: Write audit to a separate log name under Gerrit logs directory.
By default, audit records are put into the error_log.
How can I write the section gerrit.audit-sl4j.logName?
I have tried this :
But it doesn't work.
You forgot to paste the example that doesn't work for you. While you update it I can share a working example in case it can be of any help.
This is the audit-sl4j configuration part of a working gerrit.config:
[plugin "audit-sl4j"]
format = JSON
logName = audit_log
In this example, we are writing the audit logs to a file called audit_log in JSON format.
I hope this help.

log4j Properties file on daily basis

I have a log4j properties file and i want to generate log file on daily basis and remove the file before today i mean it should contains only today's log file.
I have used following Properties file:
log4j.rootLogger=ALL,Appender2
log4j.appender.Appender2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Appender2.File=log/AlertLogfile.log
log4j.appender.Appender2.append=true
log4j.appender.Appender2.layout=org.apache.log4j.PatternLayout
From the docs of DailyRollingFileAppender
The rolling schedule is specified by the DatePattern option. This pattern should follow the SimpleDateFormat conventions. In particular, you must escape literal text within a pair of single quotes. A formatted version of the date pattern is used as the suffix for the rolled file name.
log4j.rootLogger=ALL,Appender2
log4j.appender.Appender2=org.apache.log4j.DailyRollingFileAppender
log4j.appender.Appender2.File=log/AlertLogfile.log
log4j.appender.Appender2.append=true
log4j.appender.Appender2.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender2.DatePattern='.'yyyy-MM-dd

Use Barcode (code128.ttf) in Freemarker via odt template

I'm trying generate PDF file via Freemarker with odt template.
I added font code128.ttf in my OS (Windows 7)
I created ODT template in Microsoft Office Word 2010.
In this template i created field: ${MyBarcode.stringForBarcode},
and applied font code128.ttf for this field via tools of Word.
Next I saved template as *.ODT file.
Then I tried use transform:
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.ODFDOM);
IXDocReport report = getReport(uniqueTemplateId, templateContent);
report.convert(contextMap, options, outPdfFile);
But when I opened result file (PDF) there field was empty.
I think font didn't transfer in converting moment.
Maybe do you know how generate PDF with Barcode via Freemarker and ODT template ?

How to generate a doc file using Jasper Report

Using jasper-reports 5.6.1 I am able to generate the reports in pdf format, but I am not able figure out how to generate a .doc format by using jasper.
byte[] exportReportToPdf = JasperExportManager.exportReportToPdf(print);
is for generating a pdf format file like this is there any similar view class for doc format?
Try like this
JasperPrint jasperPrint = JasperFillManager.fillReport("myReport.jasper", reportParameters, dataSource);
Exporter exporter = new JRDocxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
File exportReportFile = new File("D:\\Temp\\report.docx");
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(exportReportFile));
exporter.exportReport();
HTH
Before executing a report, the JRXML must be compiled in a binary object called a Jasper file(*.jasper). This compilation is done for performance reasons. Jasper files are what you need to ship with your application in order to run the reports. Once the report is compiled it is filled with data from the application. The class net.sf.jasperreports.engine.JasperFillManager provides necessary functions to fill the data in the reports.
The report execution is performed by passing a Jasper file and a data source to JasperReports. There are plenty of types of data sources, it's possible to fill a Jasper file from an SQL query, an XML file, a csv file, an HQL (Hibernate Query Language) query, a collection of Java Beans, etc... If you don't find a suitable data source, JasperReports is very flexible and allows you to write your own custom data source.
JasperFillManager.fillReportToFile( "MasterReport.jasper" , parameters, getDataSource());
This operation creates a Jasper print file (*.jrprint), which used to either print or export the report.
- See more at: http://blog.manupk.com/2012/11/using-jasper-reports-to-create-reports.html#sthash.rFqV8K4i.dpuf

Categories

Resources