Robot Framework - Using Pabot when customized Java jars are present - robotframework

Am new to RobotFrameWork.
I have created customized keywords Using Java and created a Jar and
I have executed the test case as follows:
Case1:
Customized Created Jar Name : X.jar
Test Case Name : test.txt
I have successfully executed the test case by the following ways:
Method 1(Using standalone robot framework jar): java -cp X.jar:robotframework-2.5.3.jar org.robotframework.RobotFramework test.txt
Method 2(Using Jython) : jython -P X.jar test.txt
Can any one guide me how to use Pabot in above case.
Case2:
Customized Created Jar Name : X.jar
Test Cases Folder Name : TestCases
Test case folder contents : Test1.txt,Test2.txt,Test3.txt,Test4.txt,Test5.txt
If any of the test cases are not using X.jar
I successfully executed using Pabot command as follows.
Method 1(Using pabot directory Name): pabot TestCases
But as part of requirement in all the test cases we have to use keywords Present in X.jar.In this case how to
use Pabot to execute the test cases.
Can any one guide me in solving these issues
I have tried pabot as follows:
command: pabot --command java -jar robotframework-2.5.3.jar --end-command sx;
Note:sx is the folder name containing test cases.
But am facing an error as follows:
It started execution and am getting error as follows:
File "/usr/local/lib/python2.7/dist-packages/pabot/result_merger.py", line 116, in merge
assert len(result_files) > 0
AssertionError

robotframework-2.5.3.jar is a very very old version (released in Aug 31, 2010) and will most likely not be supported (first pabot was released in Jan 20, 2014). Please find a fresher version of Robot Framework from:
http://search.maven.org/#search%7Cga%7C1%7Ca%3Arobotframework

Related

tfs netcore integration tests by testplan - wont find the testcases

I have a netcore 6 unit test, which is linked to a tfs test case. In the build pipeline I build the netcore dll contains the test (netcore publish), and publish as an artifact (the bin\Release\net6.0\publish path).
In the release pipeline I copy the artifact files to a temp folder, then apply a Visual Studio Test step on this folder, using Test Plan, selecting test suites containing my test case.
Executing the test release pipeline I see the VS Test step found no tests (dunno what is 'test' - test case or test method):
Number of testcases discovered : 0
After this line I see
RunStatistics]This execution slice with id '8405', received '1'
testcases to execute out of which '0' is discovered.
2022-09-07T13:15:26.6593846Z ##[error]The slice of type 'Execution' is
'Aborted' because of the error :
Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException:
No test assemblies found on the test machine matching the source
filter criteria or no tests discovered matching test filter criteria.
Verify that test assemblies are present on the machine and test filter
criteria is correct.
I use MSTest, the test can be discovered in VS2022 and can be executed correctly.
In the target directory )C:\temp\automata-tfs-tests\MyAPP-autotests) there exists my DLL (Test.AutoTest.dll), also a testhost.exe (if it is interested).
Anyone has any idea what should I do to fix the problem?
Got the following (full) log:
2022-09-07T14:16:02.0649513Z ##[section]Starting: Test run for Test
plans 2022-09-07T14:16:02.0989252Z
============================================================================== 2022-09-07T14:16:02.0989349Z Task : Visual Studio Test
2022-09-07T14:16:02.0989396Z Description : Run unit and functional
tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio
Test (VsTest) runner. Test frameworks that have a Visual Studio test
adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests
using QUnit, Mocha and Jasmine), etc. can be run. Tests can be
distributed on multiple agents using this task (version 2).
2022-09-07T14:16:02.0989460Z Version : 2.153.9
2022-09-07T14:16:02.0989504Z Author : Microsoft Corporation
2022-09-07T14:16:02.0989565Z Help : More
information
2022-09-07T14:16:02.0989612Z
============================================================================== 2022-09-07T14:16:03.4309686Z SystemVssConnection exists true
2022-09-07T14:16:03.4310108Z SystemVssConnection exists true
2022-09-07T14:16:03.5947964Z SystemVssConnection exists true
2022-09-07T14:16:03.6776898Z In distributed testing flow
2022-09-07T14:16:03.6777031Z
====================================================== 2022-09-07T14:16:03.6777567Z Test selector : Test plan
2022-09-07T14:16:03.6777717Z Test plan Id : 5955
2022-09-07T14:16:03.6777832Z Test plan configuration Id : 55
2022-09-07T14:16:03.6777963Z Test suite Id selected: 5956
2022-09-07T14:16:03.6778021Z Test suite Id selected: 5959
2022-09-07T14:16:03.6778071Z Test suite Id selected: 5957
2022-09-07T14:16:03.6778205Z Search folder :
C:\temp\automata-tfs-tests\MyAPP-autotests
2022-09-07T14:16:03.6779655Z VisualStudio version selected for test
execution : latest 2022-09-07T14:16:03.6780047Z Attempting to find
vstest.console from a visual studio installation.
2022-09-07T14:16:03.6959999Z Attempting to find vstest.console from a
visual studio build tools installation. 2022-09-07T14:16:03.7387349Z
Attempting to find vstest.console from a visual studio installation.
2022-09-07T14:16:03.7808933Z Attempting to find vstest.console from a
visual studio build tools installation. 2022-09-07T14:16:03.8285853Z
Distributed test execution, number of agents in job : 1
2022-09-07T14:16:03.8286311Z Number of test cases per batch : 100
2022-09-07T14:16:03.8307860Z Run in parallel : false
2022-09-07T14:16:03.8311511Z Run in isolation : false
2022-09-07T14:16:03.8312158Z Path to custom adapters : null
2022-09-07T14:16:03.8322692Z Other console options :
/UseVsixExtensions:true /logger:trx 2022-09-07T14:16:03.8400643Z
##[warning]Other console options is not supported for this task configuration. This option will be ignored.
2022-09-07T14:16:03.8412667Z Code coverage enabled : false
2022-09-07T14:16:03.8412905Z Diagnostics enabled : false
2022-09-07T14:16:03.9119940Z
====================================================== 2022-09-07T14:16:03.9120805Z Source filter: *test.dll,!**\obj*
2022-09-07T14:16:04.0673691Z SystemVssConnection exists true
2022-09-07T14:16:04.0755317Z
[command]C:\BuildAgent_work_tasks\VSTest_ef087383-ee5e-42c7-9a53-ab56c98420f9\2.153.9\Modules\DTAExecutionHost.exe
--inputFile C:\BuildAgent_work_temp\input_9b793c20-2eb7-11ed-955e-6334f9e0a11a.json
2022-09-07T14:16:04.1535459Z
########################################################################## 2022-09-07T14:16:04.1535614Z DtaExecutionHost version 17.153.29006.1.
2022-09-07T14:16:05.1309152Z
=========================================== 2022-09-07T14:16:05.1309447Z AgentName:
BUILDAGENT-MyBu4-BUILDAGENT-MyBu4-24 2022-09-07T14:16:05.1309556Z
ServiceUrl: http://tfs:8080/tfs/MyBu/ 2022-09-07T14:16:05.1309615Z
TestPlatformVersion: 14.0.25420 2022-09-07T14:16:05.1309671Z
EnvironmentUri: vstest://env/MyAPP/_apis/release/3/764/1759/1
2022-09-07T14:16:05.1309725Z QueryForTaskIntervalInMilliseconds: 3000
2022-09-07T14:16:05.1309821Z MaxQueryForTaskIntervalInMilliseconds:
10000 2022-09-07T14:16:05.1309901Z
QueueNotFoundDelayTimeInMilliseconds: 3000
2022-09-07T14:16:05.1312343Z MaxQueueNotFoundDelayTimeInMilliseconds:
50000 2022-09-07T14:16:05.1312398Z
=========================================== 2022-09-07T14:16:05.4078702Z TestExecutionHost.Execute: Registered
TestAgent : 4034 : BUILDAGENT-MyBu4-BUILDAGENT-MyBu4-24
2022-09-07T14:16:05.4371941Z IsValidServiceResponse: Received None
command..Service Workflow is not active 2022-09-07T14:16:05.4417823Z
Updated Run Settings: 2022-09-07T14:16:05.4434862Z
2022-09-07T14:16:05.4435203Z
2022-09-07T14:16:05.4435273Z
C:\BuildAgent_work_temp\TR_46cf95a5-fd11-47f6-b503-3fa5ffad22f3 2022-09-07T14:16:05.4435335Z
2022-09-07T14:16:05.4435413Z
2022-09-07T14:16:05.6424857Z Creating run for selected test plan with
following parameters 2022-09-07T14:16:05.6426439Z Test plan ID: 5955
2022-09-07T14:16:05.6427075Z Test suite ID: 5956,5959,5957
2022-09-07T14:16:05.6427697Z Test configuration ID: 55
2022-09-07T14:16:05.7792179Z No test cases for test suite 5956
2022-09-07T14:16:06.0575605Z No test cases for test suite 5957
2022-09-07T14:16:06.0577076Z test configuration mapping:
2022-09-07T14:16:06.0617024Z test settings id : 4895
2022-09-07T14:16:06.0617414Z Run title: MyAPP Auto Test Results
2022-09-07T14:16:06.0617774Z Build location:
C:\temp\automata-tfs-tests\MyAPP-autotests
2022-09-07T14:16:06.0618880Z Build Id: 15656
2022-09-07T14:16:06.3113960Z Test run with Id 16287 associated
2022-09-07T14:16:16.4930577Z Received the command : Start
2022-09-07T14:16:16.4949323Z TestExecutionHost.ProcessCommand. Start
Command handled 2022-09-07T14:16:16.5604339Z Slice with id = 8407, of
type = 'Execution' received. 2022-09-07T14:16:16.7663381Z Count of
test sources found: 1 2022-09-07T14:16:16.7763833Z
================================================================= 2022-09-07T14:16:16.7767368Z Discovering tests from sources
2022-09-07T14:16:23.4267264Z Number of testcases discovered : 0
2022-09-07T14:16:23.4269136Z Discovered tests 0 from sources
2022-09-07T14:16:23.4299463Z
================================================================= 2022-09-07T14:16:23.4344966Z [RunStatistics]This execution slice with
id '8407', received '1' testcases to execute out of which '0' is
discovered. 2022-09-07T14:16:23.4603621Z ##[error]The slice of type
'Execution' is 'Aborted' because of the error :
Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException:
No test assemblies found on the test machine matching the source
filter criteria or no tests discovered matching test filter criteria.
Verify that test assemblies are present on the machine and test filter
criteria is correct. 2022-09-07T14:16:23.4604497Z at
Microsoft.VisualStudio.TestService.VstestAdapter.Execution.Run(ExecutionStateContext
stateModdelContext, CancellationToken cancellationToken)
2022-09-07T14:16:23.4604635Z at
Microsoft.VisualStudio.TestService.VstestAdapter.ExecutionAndPublish.Run(ExecutionStateContext
stateModelContext, CancellationToken cancellationToken)
2022-09-07T14:16:37.5289010Z Received the command : Stop
2022-09-07T14:16:37.5289369Z TestExecutionHost.ProcessCommand. Stop
Command handled 2022-09-07T14:16:37.5289442Z SliceFetch Aborted.
Moving to the TestHostEnd phase 2022-09-07T14:16:37.6567079Z Please
use this link to analyze the test run :
http://tfs:8080/tfs/MyBu/MyAPP/_TestManagement/Runs#_a=resultQuery&runId=16287&queryPath=Recent+Run%2FRun16287
2022-09-07T14:16:37.6567848Z Test run '16287' is in 'Aborted' state
with 'Total Tests' : 1 and 'Passed Tests' : 0.
2022-09-07T14:16:37.6593787Z ##[error]Test run is aborted. Logging
details of the run logs. 2022-09-07T14:16:37.6621205Z
##[error]System.Exception: The test run was aborted, failing the task. 2022-09-07T14:16:37.7157795Z
########################################################################## 2022-09-07T14:16:37.8420313Z ##[section]Finishing: Test run for Test
plans
Interestingly (this agent runs automata tests for another project without any problem) now I must add the "Visual Studio test platform installer" also and must change the setting *Test platform version" from "Latest" to "Installed by tools installer". And now it works.

How to run Hazelcast command line console

Following this suggest: Hazelcast access using CLI I tried to run Hazelcast console in the following way:
1) Downloaded file hazelcast-client-X.Y.Z.jar
2) Run
/path/to/java -cp "/path/to/hazelcast-client-X.Y.Z.jar" com.hazelcast.client.console.ClientConsoleApp
and I got
Error: Could not find or load main class com.hazelcast.client.console.ClientConsoleApp
Any suggest?
Thanks
ClientConsoleApp is not included in hazelcast-client.jar. Use hazelcast-all.jar instead. I just checked the latest version and ClientConsoleApp works fine.
$ java -cp hazelcast-all-3.12.jar com.hazelcast.client.console.ClientConsoleApp
Apr 12, 2019 9:02:15 AM com.hazelcast.config.AbstractConfigLocator
INFO: Loading 'hazelcast-client-default.xml' from the classpath.
Apr 12, 2019 9:02:18 AM com.hazelcast.client.HazelcastClient
...
I wrote a simple shell script to automate the process of:
Downloading the correct version of hazelcast-all-<version>.jar (containing the ClientConsoleApp class),
Creating the appropriate hazelcast-client.xml file for connecting to the cluster: https://github.com/YongJieYongJie/hazelcast-cli, and
Running the appropriate java command actually connect to the cluster.
Hope this proves helpful.
(Note: This is based on discussion over at this question: Hazelcast access using CLI)

How to Import Jar or Java code in Robot Framework use the methods defined in Java

I have followed all the steps provided in Link
https://blog.codecentric.de/en/2012/06/robot-framework-tutorial-writing-keyword-libraries-in-java/
Folder Structure
Running Jybot
Console:
C:\robot\execution\local\scripts>start_SampleLibrary_TestSuite.bat
C:\robot\execution\local\scripts>del ......\output*.xml /Q
The system cannot find the file specified.
C:\robot\execution\local\scripts>del ......\output*.html /Q
The system cannot find the file specified.
C:\robot\execution\local\scripts>del ......\output*.png /Q
The system cannot find the file specified.
C:\robot\execution\local\scripts>set CLASSPATH="....\lib\SampleLibrary.jar;"....\lib\SampleLibrary.jar;""
C:\robot\execution\local\scripts>echo "....\lib\SampleLibrary.jar;"....\lib\SampleLibrary.jar;""
"....\lib\SampleLibrary.jar;"....\lib\SampleLibrary.jar;""
C:\robot\execution\local\scripts>jybot --outputdir ......\output ......\implementation\testsuites\SampleLibraryTestsuite.html
[ ERROR ] Parsing '......\implementation\testsuites\SampleLibraryTestsuite.html' failed: Data source does not exist.
Any suggestions is appriciated !!
https://tutel.me/c/programming/questions/42384822/it+errors+when+specifying+the+user+defined+java+library+into+red+robot+framework+eclipse+editor
With reference to above blog, it worked !!!
Why Java? RobotFramework is python wrapper, you can use python with all its library.
Easy to import:
Library your/python/file/path.py
You can also execute a python line in one robot file
Evaluate print("Hello word")
BTW you can make your java keyword and import it in robot. Tutorial here https://blog.codecentric.de/en/2012/06/robot-framework-tutorial-writing-keyword-libraries-in-java/

How can I get Interim report when test failed and I wish to continue test in Robot Framework

I use robot framework at following environment.
Python 2.7.6
robotframework 2.8.7
Ubuntu 14.04.3 LTS
I make directory like followings,
and execute robot like this to get report in TestPTX units.
TestCaseRoot
L TestPT1
L test_1.robot
L test_2.robot
L test_3.robot
L TestPT2
L test_a.robot
L test_b.robot
$ pybot -L TRACE -b debug.log --outputdir <LOG_DIR> TestPT1/
In this case, test_1,test_2,test_3 are executed and report and log file is included one file.
But when test_2 were failed , pybot continue to execute test_3, and until test_3 were done report were not outputed.
I wish that if test_2 were failed , output report.html and log.html of test_1 and test_2(Interim report), and pybot continue to execute test_3.
Is any idea of grant my wish?
You cannot get what you want. Robot keeps the report in memory and only writes it to disk when the entire test run is completed.
You can create a listener that will give you the same information that is in the report if you wish, and you can use that to write your own file. Or, you can create a custom script that runs each suite separately, and then combines all of the individual reports after all of the tests have run.

Fail to link to standard library of Ocaml-java (or Cafesterol)

I am a new user of Ocaml-java (or Cafesterol) which compiles primtive Ocaml program to executable jar that is allowed run on JVM. However when I try to compile a test program into executable jar I got error info as follow:
>java -jar ~/ocaml-project/ocamljava-bin-1.4/bin/ocamljava.jar -standalone regexdna.ml -o regexdna.jar
File "regexdna.ml", line 1, characters 0-1:
Error: No implementations provided for the following modules:
Str referenced from regexdna.cmj
Unix referenced from regexdna.cmj
It seems module Str and Unix is missing from Ocaml-java. However, str.jar and unix.jar do exist under ~/ocaml-project/ocamljava-bin-1.4/lib/others/ when I install Ocaml-java, and within these jars we do have Str.class and Unix.class. (I suppose this directory is on the path of the standard library of Ocaml-java, so it should be included in default search path)
Can any Ocaml-java user tell me how Ocaml-java search for dependency libraries?
Quoting Xavier Clerc on this :
Well it should work, but you have to pass explicitly the referenced
library (just as in vanilla OCaml). Leading in your case to:
$ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -jar ~/opt/ocamljava-2.0-early-access9/lib/ocamljava.jar str.cmja regexdna.ml
Note that I am using the latest ocamljava preview.

Resources