← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #171648]: Search inside files and get particular data

 

Question #171648 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/171648

    Status: Open => Answered

RaiMan proposed the following answer:
Ok, this is understandable ;-)

a rough template (details about file handling see Enix's comment above):

testcasesFile = open(r"c:\testcases.txt")
pass = open(r"c:\pass.txt", "a")
fail = open(r"c:\fail.txt", "a")

testcases = testcasesFile.readlines()
testcasesFile.close()
for line in testcases:
    case = line.strip() # get rid of  linefeed
    # analyze case
    # and run your test
    # a test should return True (pass) or False (failed)
    result = runTest(case)
    if result: pass.write(line)
    else: fail.write(line)

pass.close()
fail.close()

This does not contain "remove the case from the test cases file", because in your workflow all tests are processed and pass or fail.
So removing the tests is the same as emptying the file testcases, which could be done at the end:

testcasesFile = open("c:\testcases.txt", "w")
testcasesFile.close()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.