How to send junit report via email as report doesn't display - html

I have a Junit HTML Report below in my local which is built through ANT:
Now the problem I am having is that if I try and attach this report by simply sending just the index.html, it will display this:
I want to know how can I send the above report via email so everyone can see the html report. I only want to send the index.html I don't want to send everybody the corresponding files.
The xml code to build this report is below (I xxx out some things which are not xxx in the real file):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="Test_Report" name="Test_Report">
<target name="xxx_SoapUI">
<exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
<arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>
<target name="xxx_SoapUI">
<exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
<arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>
<target name="xxx_SoapUI">
<exec dir="." executable="C:\Program Files\SmartBear\SoapUI-5.3.0\bin\testrunner.bat">
<arg line="-r -j -f 'D:\xxx\xxx' 'D:\xxx).xml'"></arg>
</exec>
</target>
</project>

The format="frames"attribute normally generates separate files for frames and maybe stylesheets. As mentioned in the task documentation, you can set the value to noframes and Ant will generate the report in a single HTML:
The noframes format does not use redirecting and generates one file called junit-noframes.html.
In case you need to customize the XSL used to generate the report, you can override it using the styledir attribute (note that the file must be named junit-noframes.xsl). The default XSL is embedded in the Ant source code and can be viewed here.

Here is alternative approach.
In this approach, do not use any attachment of the test result. Instead, host the result in a container such as tomcat or WebDAV.
Here is the example for tomcat(should be something similar for WebDAV as well):
Install tomcat
Create a directory say reports under TOMCAT_HOME\webapps directory and make sure tomcat is started.
After generating reports using current ant target, create new target for moving current reports under TOMCAT_HOME\webapps\reports\<timestamp>
Send the reports link in the email. The report link could be http://<hostname>:<port>/reports/<timestamp>/index.html
This way, every one can access the report online.

Related

Use environment variables inside google-repo manifest?

We are trying to start using google-repo in our project as the project is divided into multiple repositories. The problem is that our git server requires that one puts the username into the URL, e.g.
git clone ssh://username#git.server.com
But is it possible to get that into the manifest? I've tried the following
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="gerrit"
fetch="ssh://$USER#git.server.com"
review="ssh://$USER#git.server.com"
revision="refs/heads/master"/>
<default remote="gerrit" sync-j="4"/>
<project name="project" remote="gerrit" path="project"/>
</manifest>
but google-repo simply uses ssh://$USER#git.server.com when cloning (that is, it does not dereference environment variable $USER).
This is a ssh config issue, you should not add $USER in the remote of your manifest.
In ~/.ssh/config, add:
host whatever git.server.com
IdentityFile ~/.ssh/id_rsa
User <your_user>
IdentityFile should link to your ssh private key (YMMV).
You should now be able to
git clone ssh://git.server.com

NLog Syslog configuration files

I am trying to setup syslog in an asp.net core 2.2 project, but I can't find anything that explains this. The sample code on NLog.Target.Syslog doesn't explain enough for a newbie. I have setup logging to file using example code.
<target xsi:type="Syslog" name="cee-udp">
<sl:layout xsi:type="SimpleLayout" text="#cee: {"message": "${message}"}" />
<sl:messageCreation>
<sl:facility>Local4</sl:facility>
<sl:rfc>Rfc5424</sl:rfc>
<sl:rfc5424>
<sl:hostname xsi:type="SimpleLayout" text="${machinename}" />
<sl:appName xsi:type="SimpleLayout" text="DAEMON.MyAppName" />
<sl:procId xsi:type="SimpleLayout" text="${processid}" />
<sl:msgId xsi:type="SimpleLayout" text="${threadid}" />
<sl:disableBom>true</sl:disableBom>
</sl:rfc5424>
</sl:messageCreation>
</target>
Can you please explain what I should be putting for machinename - is that the target host or the source? How do I specify the IP of the syslog server? What is process and threadID and where is it getting the variables from?
I have Virtual Syslog Server running on another machine to test this.
just add this config target to section in Nlog.config file of your project :
<target xsi:type="Syslog" name="syslogTarget">
<sl:layout xsi:type="SimpleLayout" text="${message}" />
<sl:messageSend>
<sl:udp server="127.0.0.1" port="514" connectionCheckTimeout="0" />
</sl:messageSend>
</target>

UWP appx package Signtool "Error: SignerSign() failed." (-2147024885/0x8007000b)

EDIT
Event log error was this:
error 0x8007000B: The app manifest publisher name (CN=...)
must match the subject name of the signing certificate
(CN={19BE29DF-4812-4F2E-8FC1-A138B146946A}).
The command below now seems to work. So either user error on my part that I cannot identify or something hinky with the state of machine when I was seeing this. That guid associated with the signing cert in the event log message is not what the cert shows in the Certificate Manager snap-in, which is weird.
Original Question
I am attempting to sign a UWP appx package that was generated using MakeAppx.exe. The pfx is a developer code signing certificate generated with these commands from https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-manual-conversion.
C:\> MakeCert.exe -r -h 0 -n "CN=<publisher_name>" -eku 1.3.6.1.5.5.7.3.3 -pe -sv <my.pvk> <my.cer>
C:\> pvk2pfx.exe -pvk <my.pvk> -spc <my.cer> -pfx <my.pfx>
The private key is in my trusted root cert store and worked when I generated an appx from an installer using the Desktop App Converter.
The command line I am using is:
signtool.exe sign -f <path to my pfx file> -fd SHA256 -v .\FishTank.appx
but SignTool is erroring with this:
The following certificate was selected:
Issued to: ...
Issued by: ...
Expires: Sat Dec 31 18:59:59 2039
SHA1 hash: ...
Done Adding Additional Store
Error information: "Error: SignerSign() failed." (-2147024885/0x8007000b)
The certificate publisher matches what is in the appmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
<Identity Name="..."
ProcessorArchitecture="x64"
Publisher="CN=..."
Version="1.1.0.0" />
<Properties>
<DisplayName>Fish Tank</DisplayName>
<PublisherDisplayName>Reserved</PublisherDisplayName>
<Description>Some fish. Swimming around on your screen.</Description>
<Logo>StoreLogo.png</Logo>
</Properties>
<Resources>
<Resource Language="en-us" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.14316.0" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust"/>
</Capabilities>
<Applications>
<Application Id="FishTank" Executable="FishTank.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements
BackgroundColor="#464646"
DisplayName="Fish Tank"
Square150x150Logo="Square150x150Logo.png"
Square44x44Logo="Square44x44Logo.png"
Description="Some fish. Swimming around on your screen." />
</Application>
</Applications>
</Package>
Just like answered here (though for a different error code) - you have to make sure that the Publisher name (in the AppxManifest.xml file) is the same as the certificate's publisher.
For more information, see here (in the bottom "Remarks" section).
The MakeCert /n argument has to be the full Publisher string from your xml.

Azure Deployment from Visual Studio not deploying a JSON file correctly?

I've deployed my website to Azure, every single thing on the website got deployed just fine except a JSON file which contains a bunch of quotes.
I'm getting a 404 not found error in the console. I've tried redeploying, and that didn't work either.
When I go to the website I just get the 404, it clearly thinks that it's adding the file.
The PublishProfile looks like this:
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>http://user.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>user.scm.azurewebsites.net:123</MSDeployServiceURL>
<DeployIisAppPath>user</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$user</UserName>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
When I right click on my quotes.JSON file it has an option to Publish it. After I clicked the button to published it, it returned a response: "Your file(s) have been successfully published."
Going back to my site, it's still not there.
Interestingly enough I successfully deployed to another hosting service to test it out and everything works perfect - however, I cannot use the other service and have to stick to Azure.
Clearly something with Azure is being screwy and I'm not sure what it is.
Azure requires this in the Web.config to properly deploy a JSON file:
<system.webServer>
<staticContent>
<!--For Azure Deployment-->
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
This will make it blow up when you run on local so make sure to only include this in the release config.

parameter to mysql source file ant script

I want to pass parameters to mysql source file from ant script.
Here is my ant script.
<target name="post"
description="do post processing command: -Dusername=db-username -Dpassword=db-password -Ddb=database-name post">
<echo message="Doing Post processing..."></echo>
<sql driver="org.gjt.mm.mysql.Driver" url="jdbc:mysql://${dburl}/kom?autoReconnect=true"
userid="userid" password="password" print="yes" classpathref="class-path"
src="${sql-dir}/${post-sql}" output="logs/ant-sql.log">
</sql>
</target>
In the sql file, I have to do the following..
CREATE DATABASE IF NOT EXISTS $(dbname);
use $(dbname);
-- create table posts
-- a lot of create and insert statemenst.
I can't use mysql console or any other utilities.
Can somebody tell me how to do this ?
Solution
I moved the use $(dbname) from sql file to ant script.
<target name="post"
description="do post processing command: -Dusername=db-username -Dpassword=db-password -Ddb=database-name post">
<echo message="Doing Post processing..."></echo>
<sql driver="org.gjt.mm.mysql.Driver" url="jdbc:mysql://${dburl}/kom?autoReconnect=true"
userid="root" password="tintin" print="yes" classpathref="class-path"
src="${sql-dir}/${post-sql}" output="logs/ant-sql.log">
use ${dbname};
</sql>
</target>
It works as a temporary solution.