Selenium WebDriver Java Framework Course Limited Time Offer for $20

Selenium WebDriver Java Framework Course Limited Time Offer for $20

 

Print

Combine Lists Robot Framework

In Robot Framework, the keyword "Combine Lists" combine the given lists and return the result. See the example below. 

 

*** Settings ***
Library           Collections

*** Test Cases ***
Combine Lists Test
    [Documentation]    Combines the given lists together and returns the result. Given list does not get changed.
    @{a}=    Create List    a    b    c
    @{b}=    Create List    d    e    f
    @{ab}=    Combine Lists    ${a}    ${b}
    Log List    ${ab}
    List Should Contain Value    ${ab}    a

Run the script above the see the result below

Starting test: RobotCollectionsExample.Collections Keyword Test Suite.Combine Lists Test
20150416 23:36:51.695 :  INFO : @{a} = [ a | b | c ]
20150416 23:36:51.705 :  INFO : @{b} = [ d | e | f ]
20150416 23:36:51.705 :  INFO : @{ab} = [ a | b | c | d | e | f ]
20150416 23:36:51.705 :  INFO : 
List length is 6 and it contains following items:
0: a
1: b
2: c
3: d
4: e
5: f
Ending test:   RobotCollectionsExample.Collections Keyword Test Suite.Combine Lists Test

The result showed that List a contains (a,b,c); List b contains (d,e,f); when we combine List a and b, List ab contained (a,b,c,d,e,f); we verified that List ab contained item value f;