mkorpela / pabot

Parallel executor for Robot Framework test cases.
https://pabot.org
Apache License 2.0
470 stars 151 forks source link

pabot::Need your i/p in making use of --ordering option #247

Open krishnagkashyap opened 4 years ago

krishnagkashyap commented 4 years ago

Hi,

Since i could not find specific documentation making use of --ordering option other than the conent mentioned in the documentaion. Need your i/p on "how to making use of --ordering option when using pabot", so that i can use this option, and , am unable to figure it out after going through doc.

problem Am trying to execute 1.robot first and wait for 60sec and then execute 2.robot with pabot --ordering option.

The following is the command which is making use of,

(rf1) C:\Users\kgurupra>pabot --verbose --argumentfile1 arg1.txt --argumentfile2 arg2.txt --ordering order 1.robot 2.robot

below is the ordering file which i have created as mentioned in the[ pabot documentation](https://github.com/mkorpela/pabot#controlling-execution-order-and-level-of-parallelism).

-ordering o1.txt


--1.robot
#WAIT
--2.robot
testventure commented 4 years ago

Not a contributor but I made it work. Here is an example of my usage:

order.txt

--suite Test-Cases.Account
--suite Test-Cases.Activate
--suite Test-Cases.System-Admin
#WAIT
--suite Test-Cases.System-Offline
--suite Test-Cases.System-Users

Command-line pabot --ordering order.txt test-cases

krishnagkashyap commented 4 years ago

First of all, thank you for your response, it is now, at least getting executed. However, i would want to do something like mentioned below, i would like to run 1.robot(performs simple addition) two times with two different sets of arguments, where arg1.txt would run the same 1.robot file with var_num value as 1 and after #WAIT it would run the same file 1.robot with 11 value, however, when i run the command as mentioned below, am seeing that few time first 1.robot is ran keeping 11 and other times it is using 1 as its value. When the order is clealy mentioned as below, and arg1 is passed first in the command which is followed by arg2.txt.

can you please help me on this ? am i missing something here to get the order of execution right?

order.txt

(rf0) apachemain@apachemain:~$ cat order.txt 
--suite  mdc.1
#WAIT
--suite  mdc.1

1.robot

(rf0) apachemain@apachemain:~/mdc$ ls | xargs cat
*** Settings ***
Library OperatingSystem

*** Keywords ***
ADD NUMS
    [Arguments] ${num1}     ${num2}
    LOG TO CONSOLE  ${num1}+${num2}
    [Return]    ${num1}+${num2}

*** Test Cases ***
ADD TWO NUMBERS
    ADD NUMS    ${var_num1} ${var_num2}

Variable files

(rf0) apachemain@apachemain:~/mdc$ cat arg1.txt 
-d myoutputdir
--variablefile /home/apachemain/mdc/var1.py

(rf0) apachemain@apachemain:~/mdc$ cat arg2.txt 
-d myoutputdir
--variable var_num1:11
--variable var_num2:11

(rf0) apachemain@apachemain:~/mdc$ cat var1.py 
var_num1=1
var_num2=1

(rf0) apachemain@apachemain:~/mdc$ cat var2.py 
var_num1=11
var_num2=11

Directory structure

(rf0) apachemain@apachemain:~/mdc$ tree .
.
├── 1.robot
├── 2.robot
├── arg1.txt
├── arg2.txt
├── log.html
├── output.xml
├── __pycache__
│   └── var1.cpython-37.pyc
├── report.html
├── var0.py
├── var1.py
pabot --verbose --argumentfile1 ./mdc/arg1.txt --argumentfile2 ./mdc/arg2.txt --ordering order.txt mdc

OUTPUT

(rf0) apachemain@apachemain:~$ pabot --verbose --argumentfile1 ./mdc/arg1.txt --argumentfile2 ./mdc/arg2.txt --ordering order.txt mdc/
2020-01-19 18:26:14.871465 [PID:10300] [1] EXECUTING PARALLEL Mdc.1 with command:
robot --suite Mdc.1 --variable CALLER_ID:c00e03be4a8a4b3e8461f47d65198b98 --variable PABOTLIBURI:127.0.0.1:8270 --variable PABOTEXECUTIONPOOLID:1 --variable PABOTISLASTEXECUTIONINPOOL:0 --variable PABOTQUEUEINDEX:0 --variable PABOTLASTLEVEL:Mdc.1.PABOT_noend --argumentfile ./mdc/arg1.txt --log NONE --report NONE --xunit NONE --outputdir ./pabot_results/1/Mdc.1 --consolecolors off --consolemarkers off mdc/
2020-01-19 18:26:14.872112 [PID:10302] [0] EXECUTING PARALLEL Mdc.1 with command:
robot --suite Mdc.1 --variable CALLER_ID:589a68745f304f72b68439dafbf8b62b --variable PABOTLIBURI:127.0.0.1:8270 --variable PABOTEXECUTIONPOOLID:0 --variable PABOTISLASTEXECUTIONINPOOL:1 --variable PABOTQUEUEINDEX:1 --variable PABOTLASTLEVEL: --argumentfile ./mdc/arg2.txt --log NONE --report NONE --xunit NONE --outputdir ./pabot_results/2/Mdc.1 --consolecolors off --consolemarkers off mdc/
2020-01-19 18:26:15.175106 [PID:10300] [1] PASSED Mdc.1 in 0.3 seconds
==============================================================================
Mdc                                                                           
==============================================================================
Mdc.1                                                                         
==============================================================================
ADD TWO NUMBERS                                                       1+1
| PASS |
------------------------------------------------------------------------------
Mdc.1                                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Mdc                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /home/apachemain/pabot_results/1/Mdc.1/output.xml

2020-01-19 18:26:15.175846 [PID:10302] [0] PASSED Mdc.1 in 0.3 seconds
==============================================================================
Mdc                                                                           
==============================================================================
Mdc.1                                                                         
==============================================================================
ADD TWO NUMBERS                                                       11+11
| PASS |
------------------------------------------------------------------------------
Mdc.1                                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Mdc                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /home/apachemain/pabot_results/2/Mdc.1/output.xml

Output:  /home/apachemain/output.xml
Log:     /home/apachemain/log.html
Report:  /home/apachemain/report.html
Total testing: 0.60 seconds
Elapsed time:  0.47 seconds
testventure commented 4 years ago

Based on my limited (I've only been using pabot for a week) experience, that doesn't seem possible. If that functionality is integral to your testing then maybe writing it directly in Python using the multiprocessing library would be your best bet.

mkorpela commented 4 years ago

@krishnagkashyap could you solve your problem with the following way pabot --processes 1 --argumentfile1 ./mdc/arg1.txt --argumentfile2 ./mdc/arg2.txt mdc So use only one executor process.

krishnagkashyap commented 4 years ago

Thank you for this help! am able to see 1+1 gofirst and then 11+11. If there is anything else i shall revert. am getting a hang of this now.

(rf0) apachemain@apachemain:~$ pabot --processes 1 --verbose --argumentfile1 ./mdc/arg1.txt --argumentfile2 ./mdc/arg2.txt --ordering order.txt mdc/
2020-02-09 09:04:50.578667 [PID:18957] [0] EXECUTING PARALLEL Mdc.1 with command:
robot --suite Mdc.1 --variable CALLER_ID:0735e54482674bd481e64d63de9dd701 --variable PABOTLIBURI:127.0.0.1:8270 --variable PABOTEXECUTIONPOOLID:0 --variable PABOTISLASTEXECUTIONINPOOL:0 --variable PABOTQUEUEINDEX:0 --variable PABOTLASTLEVEL:Mdc.1.PABOT_noend --argumentfile ./mdc/arg1.txt --log NONE --report NONE --xunit NONE --outputdir ./pabot_results/1/Mdc.1 --consolecolors off --consolemarkers off mdc/
2020-02-09 09:04:50.881162 [PID:18957] [0] PASSED Mdc.1 in 0.3 seconds
==============================================================================
Mdc                                                                           
==============================================================================
Mdc.1                                                                         
==============================================================================
ADD TWO NUMBERS                                                       1+1
| PASS |
------------------------------------------------------------------------------
Mdc.1                                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Mdc                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /home/apachemain/pabot_results/1/Mdc.1/output.xml

2020-02-09 09:04:50.882894 [PID:18959] [0] EXECUTING PARALLEL Mdc.1 with command:
robot --suite Mdc.1 --variable CALLER_ID:bab25ab4b2c24a78abdd3b5af94c30e3 --variable PABOTLIBURI:127.0.0.1:8270 --variable PABOTEXECUTIONPOOLID:0 --variable PABOTISLASTEXECUTIONINPOOL:1 --variable PABOTQUEUEINDEX:1 --variable PABOTLASTLEVEL: --argumentfile ./mdc/arg2.txt --log NONE --report NONE --xunit NONE --outputdir ./pabot_results/2/Mdc.1 --consolecolors off --consolemarkers off mdc/
2020-02-09 09:04:51.187671 [PID:18959] [0] PASSED Mdc.1 in 0.3 seconds
==============================================================================
Mdc                                                                           
==============================================================================
Mdc.1                                                                         
==============================================================================
ADD TWO NUMBERS                                                       11+11
| PASS |
------------------------------------------------------------------------------
Mdc.1                                                                 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Mdc                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /home/apachemain/pabot_results/2/Mdc.1/output.xml

Output:  /home/apachemain/output.xml
Log:     /home/apachemain/log.html
Report:  /home/apachemain/report.html
Total testing: 0.60 seconds
Elapsed time:  0.76 seconds