display my own tab using command line tool - allure

Before creating a new tab report, i have tried to display the example (with attachement tab) provided on allure-report-plugins repository .
I have downloaded and upgraded the last command-line tool
I have copied the generated attachments-plugin-1.0-SNAPSHOT.jar in the same directory than the allure-cli.jar
I have executed the following command :
java -cp .;attachments-plugin-1.0-SNAPSHOT.jar allure-cli.jar generate path/to/xml
I get the a report but i don't find the new tab with attachements.
How to take into account the plugin.jar with command line tool ? Same question, if i want to use the jenkins plugin to generate report in a CI environnement.
thanks

As I understand CLI Tool is being migrated to Allure core (it already supports plugins). So, you can:
use your own patched version (please have a look at ReportGenerate.java in Allure Core repository)
wait for new version (will create pull request ~next week)
Allure plugins support in Jenkins is in progress.
(Already supported in Allure maven plugin.)

Related

MSB4062 error publishing .NET7 app with publish profile

This is pretty easy to replicate but also code here:
https://github.com/dominicshaw/dotnet-publish-error
create an empty wpf project using .NET7
create a publish profile for ClickOnce
publish via command line (not visual studio)
Publish profile is almost totally standard (view here)
Command line from project directory:
dotnet publish PublishError.csproj -p:PublishProfile=ClickOnceProfile
Subsequent error:
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\7.0.100\Microsoft.Common.CurrentVersion.targets(4149,5): error MSB4062: The "Microsoft.Build.Tasks.RequiresFr
amework35SP1Assembly" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKey
Token=b03f5f7f11d50a3a. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, a
nd that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\shawd\source\repos\PublishError\Publi
shError\PublishError.csproj]
I have the latest SDKs installed and VS2022 up to date. This only happens via command line - I am able to publish from Visual Studio (I am setting up devops, so require command line).
This happens regardless of adding nuget package for Microsoft.Build.Tasks.Core. Note however nuget package v15.1.0.0 is not available - I have tried 15.1.548 and the latest instead.
Totally at a loss! Any ideas very welcome.
Thanks vm
During the tests with your project and files, I finally managed to publish it successfully with the command dotnet publish PublishError.csproj -p:PublishProfile=FolderProfile.
Here is the document for dotnet publish, as is referred,
The preceding example uses the FolderProfile.pubxml file that is found
in the <project_folder>/Properties/PublishProfiles folder. If you
specify a path and file extension when setting the PublishProfile
property, they are ignored. MSBuild by default looks in the
Properties/PublishProfiles folder and assumes the pubxml file
extension.
And I also succeeded with dotnet publish with your project.
==============================
update on 11/19
So I suppose that the issue is resulted from your definition for -p:PublishProfile=ClickOnceProfile,it will change the path where this command would search for the publish file
A partial answer as my workaround for anyone struggling with a similar problem:
I have found it impossible to do this with the dotnet cli but I can do it with MSBuild if I specifically target 17.4 (VS2022). By default, my Azure DevOps Server 2020 capability is the 2019 MSBuild (15.X), so I have to be explicit:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" /restore /Verbosity:m /t:Publish /p:RuntimeIdentifier=win-x64 /p:configuration=Release /p:PublishProfile=ClickOnceProfile
This works - so in my pipeline I have created a batch file which runs this, then I copy the files to my ClickOnce location.
Not ideal, but a working pipeline.
Interesting side note - this dotnet cli command which should be idenitical (and indeed uses the correct 17.4 MSBuild) - does not work (with the same error):
dotnet msbuild -target:Publish -property:RuntimeIdentifiers=win-x64;Configuration=Release;PublishProfile=ClickOnceProfile

Add build number to package version with `dotnet pack` in VSTS Build process

With a .NET Framework library you could specify a version with a wildcard and NUGET pack command would append the build date and version automatically when running a NUGET Build Task in VSTS.
[assembly: AssemblyVersion("1.0.*")]
NUGET PACK would generate a NUPKG file with a version like 1.0.6604.1234 appending the date number and a build ID.
NET Standard issues
In .NET Core and .NET standard the new .csproj format does not support this wildcard format.
We can't package with Nuget.exe (reason: this issue) but we can use dotnet pack except I need to auto-increment the build numbers. The dotnet Build Task in VSTS allows me to wholly replace the version number, but I want to retain the version in the csproj file, and just append a build number (as I used to).
I found that using <VersionPrefix>x.y</VersionPrefix> in the csproj file would work with nuget pack and I could then add the additional parameter VersionSuffix=$(Build.BuildNumber) to the pack task.
All looked good until the first dev updated the project version in the project properties dialog. Visual Studio ignored the VersionPrefix and set the <Version> tag - and the build number fix is ignored because a Version tag exists.
Is there a way to read the Version from the csproj? If so I could set the build property to Version=$(ProjectVersion).$(Build.BuildNumber) ?
Or are there alternative ways to handle auto-incrementing the build version when packaging?
First you can select Use an environment variable for Automatic package versioning, use your defined variable such as temp ($(build.buildNumber)) as Environment variable.
More details take a look at this link: Dotnet pack automatic package versioning build number clarification
Another way is using the "arguments" field in the dotnet CLI task, you can pass additional arguments to the dotnet cli.
Using --version-suffix $(Build.BuildNumber) will pass the build
number as version suffix. Make sure you don't have a <version>
element set in your csproj, but rather a <versionprefix> element.
The built version will look like versionprefix-versionsuffix, so for
example, if you have <versionprefix>1.2.3</versionprefix> and build
number 201805002, the built version will be 1.2.3-201805002. In this case do not select the automatic package versioning.
Thanks to #patricklu-msft for his suggestions.
There is it appears no built-in way to emulate the wildcard behaviour we previously had NUGET pack with dotnet pack, nor was there way to get the <Version> tag out of the project file.
So I've created a new VSTS Build task that does this: VersionTaskReader in the MarketPlace.
This extension can be pointed to a .csproj or .vbproj and will set an environment variable VERSION, and VERSION_BUILD which has the BUILDID appended. You can optionally add a prefix to make each instance different if needed.
For example, if your project contains <Version>1.1</Version> then the VERSION_BUILD would be something like 1.1.8680
Then the dotnet pack task can use the environment variable VERSION_BUILD in the versioning options screen, so that the build number automatically increments.

Gatling can't run simulation

I'm using gatling 2.2.3 and I'm following the Quickstart guide. I've got it all working up until the point where I can run the scenario.
Instead of allowing me to select the simulation I want to run I'm getting this output:
U:\>%GATLING_HOME%\bin\gatling.bat
GATLING_HOME is set to "C:\Users\name\Downloads\gatling-charts-highcharts-bundle-2.2.3\"
JAVA = "java"
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
It seems like it's trying to execute some Java command which isn't done properly. Does anyone know how I can fix this?
What this folder is:
U:>%GATLING_HOME%
Be sure don't have blank spaces in it

Jenkins/Windows - Launch TestNG suite from .bat

Stackoverflow helped me a lot to reach that point but now I'm completely stuck, here is my problem :
I'm currently developing several tests to check a website. I code with Java in Eclipse, using testNG plugin with ReportNG for report, all of this using Windows 7 pro.
My tests work, and my report is well generated, so now I have to put it on Jenkins for my company so they will run my tests every X hours.
In order to launch my tests, I have made a file, named Run.bat, which runs the Java code, I tested it and it works, here is the code :
Run.bat
set classpath=blex_test_v1\bin;blex_test_v1\lib\*
java org.testng.TestNG blex_test_v1\blex_test_v1.xml
I now try to launch the tests on Jenkins, creating a new job and configuring it with the build section :
Run.bat
And this is my problem, I've tried everything (relative path, only the name of the file etc...) I always get this error :
java.io.IOException: Cannot run program "cmd" (in directory "/var/jenkins_home/jobs/blex_functional_test/workspace"): error=2, No such file or directory
So I checked the Jenkins workspace but my Run.bat is in it :
Workspace
I have read that Jenkins is in Linux so it might cause problem with bat files, so I tried to create a script but I didn't succeed either ..
So my question is : How can I run my test on Jenkins using my file Run.bat ? What am I doing wrong here ?
Thanks a lot !
Finally I can add an answer :
Jenkins is installed on a Unix machine so you can't run a bat file, it has to be a bash script.
To create a bash script, refer here.
Then you have to make sure that the plugin Xvfb is installed (and works) on the computer where Jenkins is installed.
I use testNG with reportNg and it doesn't work with the last firefox version so you I use firefox v34.0.5 and this version must be installed also on the Jenkins computer.
If you want to open the report after the execution, install another plugin and configure it (report HTML or something like that)
God it took me about a week but it's good to see it working !

command to report in sonar 5.2

I installed plugin "sonar-report-plugin" to get PDF report from sonar.
I have done all required setup in sonar for this plugin.
Now I just want to know what command to execute to get the report as "sonar-runner report" command is no longer functional in sonarqube5.2.
Indeed for technical reasons the Report plugin could not be kept compatible with SonarQube 5.2. Support is back in version 5.3, which first release candidate has been published today.
http://docs.sonarqube.org/display/SONAR/Release+5.2+Upgrade+Notes

Resources