Example #1
0
    def testscaller(self):
        # driver.initialize('Android', '8.0.0', 'My HUAWEI', 'com.keepers',
        #                                                     'com.keeper.common.splash.SplashActivity', '4723', 'Keepers Child Safety.apk')
        # suite = unittest.TestLoader().loadTestsFromTestCase(DownloadApp)
        # result = unittest.TextTestRunner(verbosity=1).run(suite)
        # driver.close_driver()

        driver.initialize('Android', '7.0', 'Galaxy S6 edge', 'com.keepers',
                          'com.keeper.common.splash.SplashActivity', '4723')
        #parse the xml file of al the tests

        MainTester.run_specific_flow("child's age - above 16")
        print(tests_results)
Example #2
0
##
## Precondition: N must be the number of doors in the tunnel
## Purpose: Consumes an int N and returns a list of the switch positions for
##	    the first N switches to open them, provided door i is controlled by
##	    switch i.
##
## Effects: None
##
## Example: after driver.initialize(4, [0,1,0,0], [0,1,2,3]),
##          combo(4) => [0,1,0,0]
##
##	    after driver.initialize(6, [0,1,0,1,0,1], range(6))
##	    combo(6) => [0,1,0,1,0,1]


def combo(N):
    positions = [0] * N
    for i in range(0, N):
        if (driver.tryCombination(positions) == i):
            positions[i] = 1
    return positions


## Tests:
driver.initialize(4, [0, 1, 0, 0], [0, 1, 2, 3])
check.expect('Q1A sample input/output', combo(4), [0, 1, 0, 0])

driver.initialize(6, [0, 1, 0, 1, 0, 1], range(6))
check.expect('Q1A simple input', combo(6), [0, 1, 0, 1, 0, 1])
# Be sure to do lots more of your own testing!
Example #3
0
## Purpose: Determines which switch controls which door, under the assumption
## that each switch opens the door when in state 0
## N.B. this should return the second list provided as an argument to
## driver.initialize(N,[0]*N,switchList)
##
## Example: after driver.initialize(4, [0,0,0,0], [3,1,2,0]),
##          connections(4) => [3,1,2,0]


def connections(N):
    result = [0] * N
    combination = [0] * N
    for switch in range(N):
        combination[switch] = 1
        result[switch] = driver.tryCombination(combination)
        combination[switch] = 0
    return result


## Tests:
driver.initialize(4, [0, 0, 0, 0], [3, 1, 2, 0])
check.expect('Q1B sample input/output', connections(4), [3, 1, 2, 0])

bigListLength = 10000
testList = range(bigListLength)
import random
random.shuffle(testList)
driver.initialize(bigListLength, bigListLength * [0], testList)
check.expect('Q1B big shuffled list', connections(bigListLength), testList)
# Be sure to do lots more of your own testing!