I generated a console.property file from katalon studio but I can't excute through command line - katalon-studio

The documentation on Katalon saying if run below command line after generating console. property file from test suites, it will run from the command window :
katalon -propertiesFile="" -runMode=console
However, it says Katalon is not recognized as an internal or external command. What should I do?

If path of katalon.exe is not defined in your PATH variable, command above will only work if you are in Katalon Studio root folder, in which katalon.exe is located.

I usually create a batch file with the following structure:
#echo off
set "qtpath=<KATALON STUDIO INSTALL DIR>"
set "execpath=%qtpath%\katalon.exe"
echo "%execpath%"
"%execpath%" <GENERATED COMMAND WITHOUT -katalon>
Hope it helps.

I had this problem. I solved that like:
[Environment Variables > System Variables > Path > Add Katalon.exe and Git.exe directories1
And then, The contents of the .gitlab-ci.yml file are as follows:
Simple .gitlab-ci.yml :
run_katalon_test_suite:
tags:
- shell
script:
- echo $CI_JOB_STAGE
Simple .gitlab-ci.yml to run test suit in Katalon Studio:
run_katalon_test_suite:
tags:
- shell
script:
- katalon -noSplash -runMode=console -consoleLog -noExit -projectPath="C:\Users\7713\git\turkuaz-katalon-test-project\turkuaz-katalon-test-project.prj" -retry=1 -retryFailedTestCases=false -testSuitePath="Test Suites/cansuarslan/TS_01_CompletedTestCases" -executionProfile="default" -browserType="Chrome"

Related

How to change the shell used in code runner?

I have nodejs installed and I can access it in my default shell (bash).
The problem is that when I try to run a file it tries to open it with /bin/sh and thus it says /bin/sh: node: command not found
The problem disappears when I set in configuration run in integrated terminal as I have set the default shell for the terminal to bash.
How to change the default shell used in the code runner to bash so that I can run the file?
The only solution I found to your same problem is to make code runner run into the vscode integrated terminal.
My settings.json
"code-runner.executorMapByGlob": {
"*.ts": "ts-node --esm $fullFileName",
},
"code-runner.runInTerminal": true
In my case it stopped happening when opened vs code on bash, in that scenario code runner runs with bash, so probably you should take a look what starts the vs code and how.
If your problem is that sh doesn't have the same path as bash just add to the /etc/profile.d a file with the following code and should work:
if [ -n "${BASH_VERSION}" ]; then
# include ~/.bashrc if it exists
if [ -f "${HOME}/.bashrc" ]; then
. "${HOME}/.bashrc"
fi
fi

Prevent Gitlab adding -NoProfile to PowerShell when starting a docker container

1. How can I prevent Gitlab from adding -NoProfile when creating the docker container?
2. What's the difference between using powershell with -NoProfile and without it?
3. Is there any way if I run powershell -NoProfile to somehow load/run the default profile and to revert the effect of setting -NoProfile flag?
And now the story behind these questions:
MSBuild (Visual Studio build tool command) fails to build Xamarin app when used in docker container started by Gitlab with Powershell -NoProfile.
I created a docker image for CI purspose and everything is working properly if I run the container manually, but when it is run during Gitlab runner job, it fails (more exactly msbuild /t:SignAndroidPackage fails, because of some file does not gets generated). I inspected this (put a sleep of 1 hour in gitlab-ci.yml and attached to the container on the runner machine) and found out that Gitlab starts the container with PowerShell -NoProfile...I tried that manually(start the container with -NoProfile) and I reproduced the issue.
the error is:
Could not find a part of the path 'C:\builds\gitlab\HMI.Framework\KDI\sub\HostApplicationToolkit\sub\KBle\KBle\sub\XamarinBluetooth\Source\Plugin.BLE.Android\Resources\Resource.Designer.cs'
Here the Resource.Designer.cs is missing (and it should be auto-generated during the build process)
This is the dockerFile:
# escape=`
# Use the latest Windows Server Core image with .NET Framework 4.8.
FROM mcr.microsoft.com/dotnet/framework/sdk:3.5-windowsservercore-ltsc2019
ENV VS_STUDIO_INSTALL_LINK=https://download.visualstudio.microsoft.com/download/pr/befdb1f9-8676-4693-b031-65ee44835915/c541feeaa77b97681f7693fc5bed2ff82b331b168c678af1a95bdb1138a99802/vs_Community.exe
ENV VS_INSTALLER_PATH=C:\TEMP\vs2019.exe
ENV ANDROID_COMPILE_SDK=29
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
ADD $VS_STUDIO_INSTALL_LINK $VS_INSTALLER_PATH
RUN %VS_INSTALLER_PATH% --quiet --wait --norestart --nocache --includeRecommended --includeOptional`
--add Microsoft.VisualStudio.Workload.NetCrossPlat `
--add Microsoft.VisualStudio.Workload.XamarinBuildTools `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
RUN del %VS_INSTALLER_PATH%
# set some util paths
RUN setx JAVA_HOME "c:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\"
RUN setx path "%path%;c:\Program Files (x86)\Android\android-sdk\tools\bin;c:\Program Files (x86)\Android\android-sdk\platform-tools"
# update android SDK with API 29
RUN echo y| sdkmanager "platforms;android-%ANDROID_COMPILE_SDK%"
#ENTRYPOINT ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
This is the gitlab-ci.yml
image: visualstudio2019-xamarin-ci:1.0-windowsservercore-ltsc2019
stages:
- build
- test
variables:
GIT_SUBMODULE_STRATEGY: 'recursive'
build_kdi:
stage: build
only:
- CI_CD
tags:
- docker-windows
script:
- '& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" ./src/KDI/KDI.sln /t:Restore /p:AndroidBuildApplicationPackage=true /p:Configuration=Release'
- '& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" /p:Configuration=Release /t:SignAndroidPackage /property:SolutionDir="C:\builds\gitlab\HMI.Framework\KDI\src\KDI\" /p:AndroidSigningKeyStore="C:\builds\gitlab\HMI.Framework\KDI\distribution\Android\KrohneAndroidKeystore.keystore" .\src\KDI\KDI\KDI.Android\KDI.Android.csproj'
run_bb_tests:
stage: test
only:
- CI_CD
tags:
- docker-windows
script:
- docker-ci/install_and_run_bb_tests.bat "phone_ip" "5555" arg1 arg2 || true
- adb pull /storage/emulated/0/Android/data/myApp/files/Exports/BBT_Exports/BBTests_CI C:\test_results
artifacts:
paths:
- c:\test_results\BBTests_CI #expire in 1 month by default
If I start this image using : docker run -it myImage powershell everything works well, but if I run it docker run -it myImage powershell -NoProfile, msbuild fails at some step in building the xamarin app
How can I prevent Gitlab from adding -NoProfile when creating the docker container?
Apparently you can't...yet but there is a feature request in place
What's the difference between using powershell with -NoProfile and without it?
A PowerShell profile is just a file that contains things, like custom functions, for a specific user. For instance, if I were to have Function Banana(){Write-Host "Awesome"} in my PowerShell profile e.g $Home[My ]Documents\PowerShell\Profile.ps1. Whenever I open up PowerShell, it loads that function automatically. So I can open PowerShell, type banana and have the string Awesome written to stdout. If I were to start powershell with -NoProfile, and enter banana, I'd get CommandNotFoundException.
source
Is there any way if I run powershell -NoProfile to somehow load/run the default profile and to revert the effect of setting -NoProfile flag?
Maybe. And I only say maybe because I haven't personally tested it, but in theory it should work. If the profile is in the container, all you have to do is dot source it.
. "C:\path\to\powershell\profile.ps1"
dot sourcing the .ps1 file will run anything within it, inside the current scope, which includes loading functions, if any are present.
dot source docs
My expertise on Gitlab is limited, but due to my overall experience with Windows containers, PowerShell, as well as the nature of PowerShell profiles, I have doubts that the profiling is the root cause of this issue, but I don't have enough information/evidence to definitively say. Hope this helps in some way!

Writing the build.ps1 console output to a specific log file

I am using cake script to build my application. While the build process all the logging informations are displayed in the console. I want to write all the console output into a specific log file in the same path where the build.ps1 is located.
Build process is like, from gitlab-ci a particular bat file will be called. That bat file will get necessary build informations and build.ps1 will be called as below.
call start /wait /i cmd /c powershell.exe -Command %PSFILE_PATH% --rebrand="app_name"
pause
[PSFILE_PATH - will have the build.ps1 file path with file name.
eg: "F:\Build\app_name\build.ps1"]
Info: I have tried using ".\build.ps1 > output.log" this works while running the build in my local machine. But, in my application build process(via gitlab-ci runner) I'm unable to use this command.
Please suggest a way(other than ".\build.ps1 > output.log") to log all the outputs printed in the console into a file while running build.ps1.
Thanks in advance.
You can persist this information from the Gitlab-ci build by saving it as an artifact. Just add this to your job's description in the gitlab-ci.yml:
artifacts:
name: 'Build output' # or whatever
when: always # or on_success/on_failure depending on your use case
paths:
- output.log
expire_in: 1 day # or 4 hours or however long you want to keep it stored
This way you can look at the output.log file via pipelines > your pipeline > artifacts.

Run setup creation using bat - install4j

I run the command:
"C:\Program Files\install4j6\bin\install4jc.exe" --license="xxx" 64DeveloperInstallation.install4j -r RADview_Test.exe
(in the xxx i put a valid license)
and i got the response: Updated licensing information.
My Goal is to run the setup creation using Bat file.
You have to execute install4jc twice, once with
--license [license key]
and then with the other parameters for building your project.

Executing subprocess.Popen inside Python script in PyDev context is different than running in terminal

I'm executing this code:
p = subprocess.Popen(['/path/to/my/script.sh','--flag'] , stdin=subprocess.PIPE)
p.communicate(input='Y')
p.wait()
It works when executing it on the shell using "python scriptName.py",
BUT when executing using PyDev in Eclipse, it fails, the reason:
/path/to/my/script.sh: line 111: service: command not found
This bash script "script.sh" contains the following command which causes the error:
service mysqld restart
So "service" is not recognized when running the .sh script from the context of PyDev.
I guess it has to do with some ENV VAR configurations, couldn't find how to do it.
BTW - Using "shell=True" when calling subprocess.Popen didn't solve it.
service usually is located in /usr/sbin, and that this directory isn't on the PATH. As this usually contains administrative binaries and scripts which arn't designed to be run by everyone (only by admins/root), the sbin directories arn't always added to the PATH by default.
To check this, try to print PATH in your script (or add an env command).
To fix it, you could either
set the PATH in your python script using os.setenv
pass an env dict containing the correct PATH to Popen
set the PATH in your shellscript
use the full path in your shellscript
set the PATH in eclipse