Error displayed after Default.srprofile is modified - specflow

I have modified .srprofile to configure my own report template.
But when executed thrown with below error message and html file is not generated -
System.InvalidOperationException: render template resource not found
at TechTalk.SpecRun.Framework.Reporting.ReportTemplateLoader.LoadTemplate(Report report)....
Changes done to .srprofile:
<Report copyAlsoToBaseFolder="true">
<Template name="ReportTemplate.cshtml" outputName="AutomationReport.html" />
</Report>"
Did i do anything wrong here?

SpecFlow+Runner is searching for the ReportTemplate.cshtml in the output directory (normally bin\debug). If you add the file to the project, in default it is not copied to the output directory.
Change "copy to output" in the properties of the file to "always"

Related

Xarmin iOS MSBuild - Missing OutputPath?

I am currently building my Xamarmin iOS project from the command line:
MSBuild "C:\code\MyProject.iOS.csproj" /t:Build /p:Configuration=Ad-Hoc;Platform=iPhone;ServerAddress=MACIP;ServerUser=MACUSER
It fails with the following error:
The OutputPath property is not set for project 'MyProject.iOS.csproj'.
Please check to make sure that you have specified a valid combination
of Configuration and Platform for this project.
However, I there is an OutputPath set when I examine the CSPROJ.
I can get around this by forcing an "OutputPath" parameter at the command line:
OutputPath="C:\builds\xamarin\cellar-ios"
Note: OutputPath="C:\builds\xamarin\cellar-ios\" does not work and build fails (notice ending back slash)
However this creates a strange folder structure where it appends the filename:
Thoughts on what I'm doing wrong here? I feel the setup is very close!
EDIT
Using the following parameters I'm able to get it to work. Note I still have to manually include the OutputPath but this gets me by for now.
/t:Build /p:Configuration=Ad-Hoc;Platform=iPhone;ServerAddress=SERVER_IP;ServerUser=USER;ServerPassword=PASS;OutputPath=bin\iPhone\Ad-Hoc\
For any customized OutputPath of your .csproj, it should be picked up by xbuild/msbuild within the .csproj or provided as a property.
One thing you can do to customize the output path of the IPA would be to use a custom MSBuild target to copy the IPA to a folder of your choice(You could use a move task if you needed):
i.e. (Inside your .csproj):
<PropertyGroup>
<CreateIpaDependsOn>
$(CreateIpaDependsOn);
CopyIpa
</CreateIpaDependsOn>
</PropertyGroup>
<Target Name="CopyIpa"
Condition="'$(OutputType)' == 'Exe'
And '$(ComputedPlatform)' == 'iPhone'
And '$(BuildIpa)' == 'true'">
<Copy
SourceFiles="$(IpaPackagePath)"
DestinationFolder="$(OutputPath)"
/>
</Target>
You then set the DestinationFolder to the desired output folder.
This is found in our KB articles here: https://kb.xamarin.com/customer/portal/articles/2061038-can-i-change-the-output-path-of-the-ipa-file-

Access to a directory that contains special characters in JBoss

I cannot access a directory that contains special characters in JBoss. I have configured JBoss so the directory listing is enabled.
For example, let's say I have a war (myApp.war) deployed in JBoss that contains a directory named "Categoría 1".
In order to access the war contents from a browser, I browse correctly to:
"http://localhost:8080/myApp/"
When I browse this URL, I get the contents displayed correctly, including "Categoría 1" directory name. The URL that the browser displays as the link to get this directory is:
"http://localhost:8080/myApp/Categor%C3%ADa%201/"
But When I try to browse this directory, I get a 404 error:
"JBWEB000065: HTTP Status 404 - /myApp/Categor%C3%ADa%201/
JBWEB000309: type JBWEB000067: Status report
JBWEB000068: message /myApp/Categor%C3%ADa%201/
JBWEB000069: description JBWEB000124: The requested resource is not available.
JBoss Web/7.2.2.Final-redhat-1"
My final intention is to get the directory contents from a servlet and parse the response to display these contents in a different way, not just the html returned as the result of browsing the directory. But since I was having the same problem with character encoding, I just tested something simpler, with a Chrome or iExplorer browser, but the problem seems to be the same.
I have found how to solve this. It is related to the JBoss configuration. The encoding must be set to UTF-8 (in my case). The configuration file for standalone server is located in:
JBoss_base_directory/standalone/configuration/standalone.xml
and the properties to set:
<system-properties>
<property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
<property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="true"/>
</system-properties>

NLog File splitting

I'm using NLog to log to file. Is there a way to configure it to create a new log file when the current one reaches a certain threshold (eg ~50mb)? Can it be done from the configuration file or code?
Yes:
fileName="${basedir}/logs/logfile.txt"
archiveFileName="${basedir}/archives/log.{#####}.txt"
archiveAboveSize="5242880"
archiveNumbering="Sequence"
concurrentWrites="true" <!-- http://nlog-project.org/doc/2.0/sl2/html/P_NLog_Targets_FileTarget_ArchiveAboveSize.htm -->

Grails - Jasper Plugin - Invalid byte 1 of 1-byte UTF-8 sequence error with .jasper file

I am using Grails 1.3.5, SQL Server 2005, iReports 3.7.6, Jasper Plugin 1.1.3. In my GSP page I have given the jasperReprt tag as:
<g:jasperReport jasper="report1" format="PDF">
<input type="hidden" name="test_id" id="test_id"/>
<input type="hidden" name="order_no" id="order_no" />
</g:jasperReport>
For development, in Config.groovy I have specified the
jasper.dir.reports = './reports'
There are two files created in the reports folder when a new report is created and saved, i.e. report.jrxml and report.jasper.
When clicked on the PDF icon in IE or Firefox, an 500 server error is thrown and below is stack trace.
[2010-11-27 01:13:14.998] ERROR groovy.grails.web.errors.GrailsExceptionResolver Invalid byte 1 of 1-byte UTF-8 sequence.
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at
But if I delete the report1.jasper, the error is no longer thrown when PDF icon is clicked and the PDF report is shown fine.
Is this the correct way to do it?
My second issue is with using Sub Reports. Sub report is in the same folder as the main report. But When the report is executed from the application, below error is thrown:
[2010-11-27 01:30:27.556] ERROR groovy.grails.web.errors.GrailsExceptionResolver Could not load object from location : ./reports\report1sub_report.jasper
net.sf.jasperreports.engine.JRException: Could not load object from location : ./reports\urine_routinepatient_details_sub_report.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:262)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327)
It does not find the sub report. How can I fix it?
Thank you.
Jay Chandran.
Edit:
I have been searching during this whole time, but still could not find a proper solution. So I did some trial and error. I figured out that, deleting report1.jasper and just leaving jasper.jrxml in the report directory works just fine as I said earlier.
For the sub-report issue: It was giving error Could not load object from location : ./reports\report1sub_report.jasper For some strange reason, the main report name report was getting appended to the name sub_report.jasper and was looking for a file named report1sub_report.jasper
So I created a sub-folder under reports folder and named it report1 and updated report1.jrxml file
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "\\sub_report.jasper"]]></subreportExpression>
I had to add the extra \\ slash even though the "SUBREPORT_DIR" parameter had \\ the slashes at the end of the path as shown below.
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["F:\\Workspace\\SpringSource2.5.0\\GrailsProjec\\reports\\report1\\"]]></defaultValueExpression>
</parameter>
Notice the \\ at the end. I don't know why it was not getting appended!
Another way would have been to just change the sub-report name from sub_report.jasper
to report1sub_report.jasper!!! :)
I have tested this in production mode and it works fine. I am not sure if this is the way to do it, but all other possible solutions did not work for me.
Feedback will be very helpful.
I assume you have a version conflict here. iReport stores JRXML files and seems to compile them automatically to .jasper. The Grails Jasper plugin picks up the compile variant and gets into trouble with it. So try to disable compiled output in ireport.
The Grails Jasper plugin 1.1.3 uses internally Jasper 3.7.4, the used ireport is 3.7.6.
Regarding the sub reports: no idea.
The MalformedByteSequenceException is caused by a character encoding conflict. I'd suggest to use UTF-8 instead of Windows' Win-1252 (similar to ISO-8859-1) everywhere.
In Jasper's etc/ireport.conf file, change the default_options to:
default_options="-J-Dfile.encoding=UTF-8 -J-Xms24m -J-Xmx64m"
(Where Xms and Xmx are unrelated memory settings. If there are default settings with that config entry, you can overtake them, else, just leave them out.)
See this forum thread for alternative configurations.
As for the error with subreports, take a look at the backslash \ that's probably wrong.
EDIT : There is some information about two issues which maybe could help in
http://grails.org/plugin/jasper#faqTab
i hope i can help with one of the issues: which one related with subreports dir.
The problem is the plugin code sets SUBREPORT_DIR to the complete file path of main report, including its name. However the code honour the user provided param with the same name, so if you fill this param with whatever value except null the plugin will use it.
For example if you chain directly the jasper controller you can do:
def renderAs(data,format) {
def reportParams=params.clone()
reportParams["_format"]=reportParams["_format"]?:"${format.toUpperCase()}"
reportParams["SUBREPORT_DIR"]=CH.config.jasper.dir.reports+"/"
chain(controller:'jasper',action:'index',model:[data:[]+data],params:reportParams)
}
In your scenario an (ugly) option would be create an hidden input with name SUBREPORT_DIR and value the desired one. I would fill the paremeter in other way.
EDIT:
Another annoying problem is where do we have to put the main reports and compiled subreports:
When you run the app with run-app they work if you put them all in a folder with the same name as CH.config.jasper.dir.reports(reportDir) in the root of the grails app.
But if you want to deploy a war you have to put the main reports in a folder reportDir in the root of war file and compiled subreports in WEB-INF/classes/reportDir.
I've opted to keep all files in grailsApp/reports and copy the resources in the appropiate folders in the war grails task. In my BuildConfig.groovy i've added (reportDir is "reports"):
grails.war.resources = { stagingDir,args ->
def classpathDir="${stagingDir}/WEB-INF/classes"
copy(toDir:"${stagingDir}/reports") {
fileset(dir:"reports",includes:"**")
}
copy(toDir:"${classpathDir}/reports") {
fileset(dir:"reports",excludes:"**.jrxml")
}
}
Hope it helps.

PartCover browser not opening code files

We're generating PartCover reports via the command line tool along with our CruiseControl.Net unit tests. This generates an xml file that displays the results nicely on the cruisecontrol dashboard. The xslt transforms that are included only show you the percentage of coverage in an individual class. We want to know exactly what lines are not being covered. The problem ist when we open the report in the PartCover browser and double click a method it doesn't show us our cs files. I know the PartCover browser is capable of showing you the files because of the following.
Here's a screenshot of PartCover browser with the lines of code showing: http://kjkpub.s3.amazonaws.com/blog/img/partcover-browse.png.
The information looks like it should be available to the browser because the report contains this:
<Method name="get_DeviceType" sig="Cathexis.IDBlue.DeviceType ()" bodysize="19" flags="0" iflags="0">
<pt visit="2" pos="0" len="1" fid="82" sl="35" sc="13" el="35" ec="14" />
<pt visit="2" pos="1" len="4" fid="82" sl="36" sc="17" el="36" ec="39" />
<pt visit="2" pos="5" len="2" fid="82" sl="37" sc="13" el="37" ec="14" />
</Method>
and this:
<File id="66" url="D:\sandbox\idblue\idblue\trunk\software\code\driver\dotnet\Common\AsyncEventQueue.cs" />
All I want to be able to do is view what lines of code are not being covered in my test cases without having to figure out what the xml above is trying to tell me.
Thanks to anyone in advance who replies.
I figured out why the cs files were not displaying. The paths were incorrect in the xml file because our test project was being built on a different machine than the one partcover was on. (partcover must generate the .cs file paths from pdb files maybe?) Once I search and replaced the file switching the base directory of our subversion location to the one on the other machine all was well.

Resources