Allure2 report not using allure.properties for #Issue - allure

In my current setup I have it so that I can have a static allure.properties file located in my allure-results folder. This properties file holds the value for the #Issue environment variable and value.
allure.link.issue.pattern=https\://tfs.mytfs.com/tfs/_workitems?id\={}
When I generate the report allure generate --clean <results dir> -o <report dir> it does not appear to be using the allure.properties file to populate the #Issue links with the correct value. Instead, the link value is blank and the link redirects to itself.
I am using the updated #Issue environment variable. I think this might be due to how I am generating the report as the documentation states "simply generate the report. By default command-line tool looking for config in the directory you run the command. You can use ALLURE_CONFIG environment variable to specify the path to configuration".
I am not sure what I am missing though as I run the generate command from the results folder. Is that not correct?

Since version Allure 2 no need to pass allure.properties file to allure-results folder. You need to add it to your test resources instead.
Here you can find an example https://github.com/allure-examples/allure-testng-example/blob/master/src/test/resources/allure.properties

Related

The term 'behave' is not recognized as the name of a cmdlet, function

I have Python 3.10.7 with the follwing packgaes installed using pip install in command line:
behave 1.2.6
selenium 4.4.3
These have also been added to the packagelist of the project using the project config in pycharm
Also behave is in the systme path as well along with python.
I am trying to use the behave command but I am getting the following error:
behave : The term 'behave' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ behave features\myfeaturefile.feature
Following is my project directory:
Following is my project in pycharm:
I need help in fixing this problem as I am new to this tool. Thanks
First check if you have behave and python in the path variables.
Check if you can execute the below command
C:\demo>behave -h
If this does not return a list of help commands associated with behave, this means that behave is not in the path variables
Alternatively, you can check it via cmd using the "PATH" command. This will show you all the entries in the system path
C:\demo>PATH
PATH=C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\Program Files\AdoptOpenJDK\jdk-11.0.11.9-hotspot\bin...
If behave or python are not in the path variables, you can set them using
set PATH=%PATH%;c:\PATH_TO_BEHAVE
NOTE: Setting path using cmd is only valid till the time the cmd window is open. Once you close it, the path variable will be rest to original values.
Behave, along with a few other .exe files is sitting in the:
C:\Users\chauhany\AppData\Roaming\Python\Python310\Scripts
As per your instructions #Manish Agarwal, I added the C:\Users\chauhany\AppData\Roaming\Python to the PATH from the command line and re-started the machine. But it didn't help. I then moved the behave.exe from the above location to my python 3.10 directory which is sitting in C:\Program Files\Python310 and python is in the system path, and restarted my machine again.
I then deleted and recreated my project with the new feature file (same directory structure).
If I now run the same command, that is, features\myfeaturefile.feature from
C:\Users\chauhany\PycharmProjects\martechBehaveProject>
I get a FileNotFound error
So I went to the folder where the file is actually sitting that is:
C:\Users\chauhany\PycharmProjects\martechBehaveProject\features\steps> and then re-ran the command and it worked.
I was under the impression that if you have just one feature file you don't have to specify the actual feature file and it can be run from anywhere in your project i.e., from any location which certainly is not correct.

Having trouble setting up chocolateyinstall.ps1 to link path enviorment variable with program file

Having trouble setting automatically set PATH to programFiles\veyon after installation. I would like to use the veyon-ctl command line with out having to manually link it.
The code that you have highlighted seems to be working exactly as expected. I have just taken that code, and added it to a package and installed it. The result was the following...
As you will see mentioned in the output, this environment variable will not be available in the current shell until you open/close the shell. I suspect that this is the problem that you are running into.
Chocolatey does provide a helper function called refreshenv which would allow you to force the reloading of the environment variables into the current shell, however, this isn't enabled by default. You can find out how to do this by reading the article here:
https://chocolatey.org/docs/troubleshooting#i-cant-get-the-powershell-tab-completion-working
But what it comes down to is that you need to load the following into your PowerShell Profile:
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Once this is loaded, after seeing output similar to the following when installing a Chocolatey package, you can execute the command refreshenv and the new environment variables will be available in the current shell.

Get build agent folder path in tfs build

How to access TFS build agent folder path in using batchfile?
I am calling runscript tool from build workflow (calling windows batchfile).
I tried to use the environment variable BUILD_REPOSITORY_LOCALPATH ($(BUILD_REPOSITORY_LOCALPATH), $env:BUILD_REPOSITORY_LOCALPATH) but they dint give any result.
Need some assistance on this.
I used another workaround for this instead of getting by workspace. From sourceDirectory folder i drill down to find my solution project file, the path containing my solution project is the local directory path i need
From batchfile i call my exe and pass %TF_BUILD_SOURCESDIRECTORY% as parameter.
string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory)
// targetdirectory would be the input parameter from batch file`
for (int i = 0; i < subdirectoryEntries.Length ; i++)
{
// My root folder always contains a specific folder with name MyFolder
// and a file Myfile.sln
if (subdirectoryEntries[i].ToString().ToLower().Contains(#"MyFolder"))
{
Console.Writeline("My source code path is " + targetDirectory);
}
//Similarly I check for Myfile.sln and then get my path.
}
This may be a very crude way, this worked for me.
The variable you are looking for is TF_BUILD_SOURCESDIRECTORY. Please refer to the XAML build documentation.
TF_BUILD_SOURCESDIRECTORY: The sources sub-directory of the build agent working directory. This directory contains your source code. For example: C:\Build\BuildBot3\CoolApp\CIBuild\src.
If you want to get C:\TFS_Build\src\V9, it's just local path: the path that you have mapped the server path to on your machine. There is not any built-in TF_BUILD environment variables could achieve your requirement.
You could use TFS API to get the related info, first get the workspace information for the build server's workspace, then do the get option, a sample code for your reference:
// Get the workspace information for the build server's workspace
var workspaceInfo = Workstation.Current.GetLocalWorkspaceInfo(sourcesDirectory);
// Get the TFS Team Project Collection information from the workspace cache
// information then load the TFS workspace itself.
var server = new TfsTeamProjectCollection(workspaceInfo.serverUri);
var workspace = workspaceInfo.GetWorkspace(server);
Once you have a workspace, you can query it for the path mappings. It
will do the necessary translation from server to local path based on
your workspace mappings. For example:
workspace.GetServerItemForLocalItem("C:\TFS_Build\src\V9");
and
workspace.GetLocalItemForServerItem("$/DEV/V9");
This mechanism will only work, however, if your build definition
actually sets up the workspace to include these files.
More details please refer this similar question: How do I resolve the root and relative paths of TFS folders on the server?
update from OP:
From sourceDirectory folder i drill down to find my solution project
file, the path containing my solution project is the local directory
path i need

Javac not recognised

I tried typing the name of the bat file (makejar.bat) from the containing direcory from the command line. It gives several errors all containing "'javac' is not recognised as an internal or external command."
This sounds like a java class path problem.
You can find the instructions to set the java CLASSPATH on the following Oracle web page.
I suppose you are working on Windows, so make sure that your environment variables are properly set:
JAVA_HOME - points to a proper JDK installation
PATH - contains a references to JAVA_HOME, something like: **PATH;%JAVA_HOME%\bin**
This should do it! Make sure to restart the command line you are using after making changes to environment variables.
You can see how to set/add environment variables on windows here.
On CMD--> type--> PATH="c:\Program Files\Java\jdk1.8.0_144\bin";
and then check java path by type "java -version" on cmd
and also check on YouTube : -https://www.youtube.com/watch?v=mzAAmJj-W6w

Creating Bat file from inno setup file

I have an inno setup code which works fine. Can anyone tell me how to make a bat file from an inno setup code so that a single click will initiate the installation set up.I have done that for java class files.Any help is appreciated.
There should be no need for a .bat file. Inno Setup creates a stand-alone executable (by default named Setup.exe) that you can simply double-click like any other Windows executable.
The executable it creates is nameable either by renaming the Setup.exe to a different name (YourAppSetup.exe, for instance) manually, or by using the OutputBaseName value in the [Setup] section. You can control where the setup executable is created by using the [Setup] section value OutputDir. Here's an example, from the CodeExample1.iss' sample provided in yourInno Setup` installation:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={code:MyConst}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
InfoBeforeFile=Readme.txt
OutputDir=userdocs:Inno Setup Examples Output
This creates the default Setup.exe in the userdocs: (your My Documents folder), in a subfolder named Inno Setup Examples Output. To put it somewhere else, just change the OutputDir entry to a different location. For instance, to put it in a sub-directory of your source folder named Installer, just use
OutputDir=Installer
For more info, see the documentation, in the Setup Script Sections->[Setup] Section Directives branch.
To change the name from Setup.exe to something else, add a new entry:
OutputBaseName=MyAppSetup

Resources