2016-11-28 1 views
1

나는 Testcase를 작성하여 엑셀 시트의 로그인 세부 정보를 읽고 로그인 및 로그 아웃 할 세부 정보 쌍을 읽습니다.로봇 프레임 워크의 목록에서 값을 지우거나 제거하는 방법

Excel에서 데이터를 읽는 중, 각 행의 세부 정보가 목록으로 전달되어 로그인으로 다른 키워드/함수에 입력으로 전송됩니다.

로그 아웃 후 목록의 값을 제거하고 성공한 것으로 표시되었지만 다음 실행시 이전 값도 표시됩니다.

나는 모든 목록 값을 지우는 키워드를 찾지 못했습니다.

도와 주실 수 있습니까? 값이 제거대로 보여 주었다 출력에서 ​​

*** Settings *** 
     Documentation  CLM Registration Test Case 
     Test Teardown  Close All Browsers 
     Library   Selenium2Library 
     Library   Collections 
     Library   ExcelLibrary 
     Library   String 

    *** Variables *** 
    ${delay}   5s 
    ${excelName}  LoginTestData.xls 
    @{rowValues} 
    ${rowCount}  ${EMPTY} 
    ${cellCount}  ${EMPTY} 

    *** Test Cases *** 
    Get Data from Excel 
     Open Excel Sheet ${excelName} 
     @{sheetNames} Get Sheet Names 
     ${sheetName} Set Variable @{sheetNames}[0] 
     ${rowCount} Get Row Count ${sheetName} 
     ${cellCount} Get Column Count ${sheetName} 
     : FOR ${rindex} IN RANGE 1 ${rowCount} 
     \ @{rowValues} Get Values ${sheetName} ${rindex} ${cellCount} 
     \ Log to console row values are for index ${rindex} : @{rowValues} 
     \ Login to the CLM @{rowValues} 
     \ Log cell count is : ${cellCount} 
     \ Change Language to English 
     \ Sleep ${delay} 
     \ Logout from CLM 
     \ Remove Values ${rowValues} ${cellCount} 

    *** Keywords *** 
    Open Excel Sheet 
     [Arguments] ${excelName} 
     Open Excel ${excelName} useTempDir=False 

    Get Values 
     [Arguments] ${sName} ${row} ${cCount} 
     Log to console user is in Get Values function 
     : FOR ${cindex} IN RANGE 0 ${cCount} 
     \ Log to console get the data from ${sName}[${cindex}][${row}] 
     \ ${cellValue} Read Cell Data By Coordinates ${sName} ${cindex} ${row} 
     \ Insert Into List ${rowValues} ${cindex} ${cellValue} 
     [Return] @{rowValues} 

    Login to the CLM 
     [Arguments] @{rowValues} 
     Open Browser http://172.20.24.74/clm-ui/#/login/ chrome 
     Maximize Browser Window 
     Sleep ${delay} 
     Input Text id=username @{rowValues}[0] 
     Input Password id=password @{rowValues}[1] 
     Click Button css=.btn.btn-primary 

    Remove Values 
     [Arguments] ${rowValues} ${cellCount} 
     Log to console rowvalues are : ${rowValues} and cell Count: ${cellCount} 
     : FOR ${index} IN RANGE 0 ${cellCount} 
     \ ${value}= Remove from List ${rowValues} -1 
     \ Log to console value removed from list is : ${value} 

    Change Language to English 
     Sleep ${delay} 
     Wait Until Element Is Visible xpath=//*[@id='top-navbar']/ul[2]/li/a/span[2] 30s 
     Click Element xpath=//*[@id='top-navbar']/ul[2]/li/a/span[2] 
     Click Element xpath=//*[@id='top-navbar']//a[contains(text(),'English')] 

    Logout from CLM 
     Sleep ${delay} 
     Click Element xpath=//*[@id='top-navbar']/ul[2]/li/a/span[2] 
     Click Link link=Logout 

하지만, 다음 실행, 또한 이전 값 밖으로 아래 넣어

보여 주었다 : 여기에 코드입니다

=========================================================================================================== 
ReadExcel :: CLM Registration Test Case                  
=========================================================================================================== 
Get Data from Excel                    user is in Get Values function 
get the data from LoginDetails[0][1] 
get the data from LoginDetails[1][1] 
row values are for index 1 : [u'akurasa', u'Srija210$'] 
rowvalues are : [u'akurasa', u'Srija210$'] and cell Count: 2 
value removed from list is : Srija210$ 
value removed from list is : akurasa 
user is in Get Values function 
get the data from LoginDetails[0][2] 
get the data from LoginDetails[1][2] 
row values are for index 2 : [u'clmui', u'tecnotree', u'akurasa', u'Srija210$'] 
rowvalues are : [u'clmui', u'tecnotree', u'akurasa', u'Srija210$'] and cell Count: 2 
value removed from list is : Srija210$ 
value removed from list is : akurasa 
| PASS | 
----------------------------------------------------------------------------------------------------------- 

답변

2

키워드를 사용해보십시오를 "Remove Values"사용자 정의 키워드 대신 FOR 루프의 마지막 단계로 "Create List"를 사용하십시오. 이 명령은 목록

+0

안녕 케쉬에있는 값을 삭제합니다 : 열 수는 각 행

Get Data from Excel Open Excel Sheet ${excelName} @{sheetNames} Get Sheet Names ${sheetName} Set Variable @{sheetNames}[0] ${rowCount} Get Row Count ${sheetName} : FOR ${rindex} IN RANGE 1 ${rowCount} \ ${cellCount} Get Column Count ${sheetName} \ @{rowValues} Get Values ${sheetName} ${rindex} ${cellCount} \ Log to console row values are for index ${rindex} : @{rowValues} \ Login to the CLM @{rowValues} \ Log cell count is : ${cellCount} \ Change Language to English \ Sleep ${delay} \ Logout from CLM \ @{rowValues} Create List 

"@ {rowValues} 목록 만들기"에 따라 다릅니다 경우에도, 루프 내부의 변수 $ {cellCount을} 이동 , 죄송합니다, 당신이 "Create List"사용자 정의 키워드에서 구현해야하는 기능을 얻지 못했습니다. –

+0

"목록 만들기"는 BuiltIn 라이브러리에서 사용할 수있는 라이브러리 키워드입니다. 스크립트를 작성할 필요가 없습니다. 위의 스크립트를 복사하여 테스트 케이스 섹션에 붙여 넣기 만하면됩니다. 그것을 시도하고 업데이 트하십시오. – Rakesh

+0

감사합니다. Rakesh 님, 감사합니다. –

관련 문제