Best Python code snippet using lemoncheesecake
test.py
Source:test.py  
1# AUTHOR: Jared Potter (u0729256)2#3# DATE: September 29, 20154#5# Python unittest tests for CoreUtils expr utility6import os7from subprocess import Popen, PIPE8import unittest9class ExprTest(unittest.TestCase):10  def testNumber1(self):11    myTest = Expression('1 = 1'.split())12    self.assertEqual(myTest.executeTest(),'1\n')13  def testNumber2(self):14    myTest = Expression('312313 = 312313'.split())15    self.assertEqual(myTest.executeTest(),'1\n')16  def testNumber3(self):17    myTest = Expression('-928424 = -928424'.split())18    self.assertEqual(myTest.executeTest(),'1\n')19  def testNumber4(self):20    myTest = Expression('-9223372036854775808 = -9223372036854775808'.split())21    self.assertEqual(myTest.executeTest(),'1\n')22  def testNumber5(self):23    myTest = Expression('9223372036854775807 = 9223372036854775807'.split())24    self.assertEqual(myTest.executeTest(),'1\n')25  def testNumber6(self):26    myTest = Expression('0803583085345 = 349875937535'.split())27    self.assertEqual(myTest.executeTest(),'0\n')28  def testNumber7(self):29    myTest = Expression('0 = 1'.split())30    self.assertEqual(myTest.executeTest(),'0\n')31  def testNumber8(self):32    myTest = Expression('112313 = 15345353635343434'.split())33    self.assertEqual(myTest.executeTest(),'0\n')34  def testNumber9(self):35    myTest = Expression('1 = 9223372036854775807'.split())36    self.assertEqual(myTest.executeTest(),'0\n')37  def testNumber10(self):38    myTest = Expression('-9223372036854775808 = 9223372036854775807'.split())39    self.assertEqual(myTest.executeTest(),'0\n')40  def testNumber11(self):41    myTest = Expression("0 | 0".split())42    self.assertEqual(myTest.executeTest(),'0\n')43  def testNumber12(self):44    myTest = Expression("0 | 1".split())45    self.assertEqual(myTest.executeTest(),'1\n')46  def testNumber13(self):47    myTest = Expression("1 | 0".split())48    self.assertEqual(myTest.executeTest(),'1\n')49  def testNumber14(self):50    myTest = Expression("1 | 1".split())51    self.assertEqual(myTest.executeTest(),'1\n')52  def testNumber15(self):53    myTest = Expression("112312314 | 0".split())54    self.assertEqual(myTest.executeTest(),'112312314\n')55  def testNumber16(self):56    myTest = Expression("0 & 0".split())57    self.assertEqual(myTest.executeTest(),'0\n')58  def testNumber17(self):59    myTest = Expression("0 & 1".split())60    self.assertEqual(myTest.executeTest(),'0\n')61  def testNumber18(self):62    myTest = Expression("1 & 0".split())63    self.assertEqual(myTest.executeTest(),'0\n')64  def testNumber19(self):65    myTest = Expression("1 & 1".split())66    self.assertEqual(myTest.executeTest(),'1\n')    67  def testNumber20(self):68	myTest = Expression("1523425 & 164535".split())69	self.assertEqual(myTest.executeTest(),'1523425\n')70  def testNumber21(self):71    myTest = Expression("0 < 0".split())72    self.assertEqual(myTest.executeTest(),'0\n')73  def testNumber22(self):74    myTest = Expression("0 < 1".split())75    self.assertEqual(myTest.executeTest(),'1\n')76  def testNumber23(self):77    myTest = Expression("1 < 0".split())78    self.assertEqual(myTest.executeTest(),'0\n')79  def testNumber24(self):80    myTest = Expression("1 < 1".split())81    self.assertEqual(myTest.executeTest(),'0\n')    82  def testNumber25(self):83	myTest = Expression("152342 < 164535".split())84	self.assertEqual(myTest.executeTest(),'1\n')85  def testNumber26(self):86    myTest = Expression("0 <= 0".split())87    self.assertEqual(myTest.executeTest(),'1\n')88  def testNumber27(self):89    myTest = Expression("0 <= 1".split())90    self.assertEqual(myTest.executeTest(),'1\n')91  def testNumber28(self):92    myTest = Expression("1 <= 0".split())93    self.assertEqual(myTest.executeTest(),'0\n')94  def testNumber29(self):95    myTest = Expression("1 <= 1".split())96    self.assertEqual(myTest.executeTest(),'1\n')    97  def testNumber30(self):98	myTest = Expression("152342 <= 164535".split())99	self.assertEqual(myTest.executeTest(),'1\n')100  def testNumber31(self):101    myTest = Expression("0 != 0".split())102    self.assertEqual(myTest.executeTest(),'0\n')103  def testNumber32(self):104    myTest = Expression("0 != 1".split())105    self.assertEqual(myTest.executeTest(),'1\n')106  def testNumber33(self):107    myTest = Expression("1 != 0".split())108    self.assertEqual(myTest.executeTest(),'1\n')109  def testNumber34(self):110    myTest = Expression("1 != 1".split())111    self.assertEqual(myTest.executeTest(),'0\n')    112  def testNumber35(self):113	myTest = Expression("152342 <= 164535".split())114	self.assertEqual(myTest.executeTest(),'1\n')115  def testNumber36(self):116    myTest = Expression("0 > 0".split())117    self.assertEqual(myTest.executeTest(),'0\n')118  def testNumber37(self):119    myTest = Expression("0 > 1".split())120    self.assertEqual(myTest.executeTest(),'0\n')121  def testNumber38(self):122    myTest = Expression("1 > 0".split())123    self.assertEqual(myTest.executeTest(),'1\n')124  def testNumber39(self):125    myTest = Expression("1 > 1".split())126    self.assertEqual(myTest.executeTest(),'0\n')    127  def testNumber40(self):128	myTest = Expression("152342 > 164535".split())129	self.assertEqual(myTest.executeTest(),'0\n')130  def testNumber41(self):131    myTest = Expression("0 >= 0".split())132    self.assertEqual(myTest.executeTest(),'1\n')133  def testNumber42(self):134    myTest = Expression("0 >= 1".split())135    self.assertEqual(myTest.executeTest(),'0\n')136  def testNumber43(self):137    myTest = Expression("1 >= 0".split())138    self.assertEqual(myTest.executeTest(),'1\n')139  def testNumber44(self):140    myTest = Expression("1 >= 1".split())141    self.assertEqual(myTest.executeTest(),'1\n')    142  def testNumber45(self):143	myTest = Expression("152342 >= 164535".split())144	self.assertEqual(myTest.executeTest(),'0\n')145  def testNumber46(self):146    myTest = Expression("0 + 0".split())147    self.assertEqual(myTest.executeTest(),'0\n')148  def testNumber47(self):149    myTest = Expression("0 + 1".split())150    self.assertEqual(myTest.executeTest(),'1\n')151  def testNumber48(self):152    myTest = Expression("1 + 0".split())153    self.assertEqual(myTest.executeTest(),'1\n')154  def testNumber49(self):155    myTest = Expression("1 + 1".split())156    self.assertEqual(myTest.executeTest(),'2\n')    157  def testNumber50(self):158	myTest = Expression("152342 + 164535".split())159	self.assertEqual(myTest.executeTest(),'316877\n')160  def testNumber51(self):161    myTest = Expression("0 - 0".split())162    self.assertEqual(myTest.executeTest(),'0\n')163  def testNumber52(self):164    myTest = Expression("0 - 1".split())165    self.assertEqual(myTest.executeTest(),'-1\n')166  def testNumber53(self):167    myTest = Expression("1 - 0".split())168    self.assertEqual(myTest.executeTest(),'1\n')169  def testNumber54(self):170    myTest = Expression("1 - 1".split())171    self.assertEqual(myTest.executeTest(),'0\n')    172  def testNumber55(self):173	myTest = Expression("152342 - 164535".split())174	self.assertEqual(myTest.executeTest(),'-12193\n')175  def testNumber56(self):176    myTest = Expression("0 * 0".split())177    self.assertEqual(myTest.executeTest(),'0\n')178  def testNumber57(self):179    myTest = Expression("123 * 2".split())180    self.assertEqual(myTest.executeTest(),'246\n')181  def testNumber58(self):182    myTest = Expression("2 * 6".split())183    self.assertEqual(myTest.executeTest(),'12\n')184  def testNumber59(self):185    myTest = Expression("1 * -1".split())186    self.assertEqual(myTest.executeTest(),'-1\n')    187  def testNumber60(self):188	myTest = Expression("152342 * 164535".split())189	self.assertEqual(myTest.executeTest(),'25065590970\n')190  def testNumber61(self):191    myTest = Expression("0 / 0".split())192    self.assertEqual(myTest.executeTest(),'')193  def testNumber62(self):194    myTest = Expression("123 / 2".split())195    self.assertEqual(myTest.executeTest(),'61\n')196  def testNumber63(self):197    myTest = Expression("2 / 6".split())198    self.assertEqual(myTest.executeTest(),'0\n')199  def testNumber64(self):200    myTest = Expression("1 / -1".split())201    self.assertEqual(myTest.executeTest(),'-1\n')    202  def testNumber65(self):203	myTest = Expression("164535 / 152342".split())204	self.assertEqual(myTest.executeTest(),'1\n')205  def testNumber66(self):206    myTest = Expression("0 % 0".split())207    self.assertEqual(myTest.executeTest(),'')208  def testNumber67(self):209    myTest = Expression("123 % 2".split())210    self.assertEqual(myTest.executeTest(),'1\n')211  def testNumber68(self):212    myTest = Expression("2 % 6".split())213    self.assertEqual(myTest.executeTest(),'2\n')214  def testNumber69(self):215    myTest = Expression("1 % -1".split())216    self.assertEqual(myTest.executeTest(),'0\n')    217  def testNumber70(self):218	myTest = Expression("164535 / 152342".split())219	self.assertEqual(myTest.executeTest(),'1\n')220  def testNumber71(self):221    myTest = Expression("0 % 0".split())222    self.assertEqual(myTest.executeTest(),'')223  def testNumber72(self):224    myTest = Expression("123 % 2".split())225    self.assertEqual(myTest.executeTest(),'1\n')226  def testNumber73(self):227    myTest = Expression("2 % 6".split())228    self.assertEqual(myTest.executeTest(),'2\n')229  def testNumber74(self):230    myTest = Expression("1 % -1".split())231    self.assertEqual(myTest.executeTest(),'0\n')    232  def testNumber75(self):233	myTest = Expression("164535 % 152342".split())234	self.assertEqual(myTest.executeTest(),'12193\n')235  def testNumber76(self):236    myTest = Expression("9223372036854775807 + 9223372036854775807".split())237    self.assertEqual(myTest.executeTest(),'')238  def testNumber77(self):239    myTest = Expression("-9223372036854775807 - 9223372036854775807".split())240    self.assertEqual(myTest.executeTest(),'')241  def testNumber78(self):242    myTest = Expression("9223372036854775807 * 9223372036854775807".split())243    self.assertEqual(myTest.executeTest(),'')    244  def testNumber79(self):245	myTest = Expression("9223372036854775807 / 0.5".split())246	self.assertEqual(myTest.executeTest(),'')247  def testNumber80(self):248    myTest = Expression("9223372036854775809 + 2".split())249    self.assertEqual(myTest.executeTest(),'')250  def testKeyword1(self):251    myTest = Expression('--help'.split())252    self.assertEqual(myTest.executeTest(),"Usage: ../coreutils/src/./expr EXPRESSION\n  or:  ../coreutils/src/./expr OPTION\n\n      --help     display this help and exit\n      --version  output version information and exit\n\nPrint the value of EXPRESSION to standard output.  A blank line below\nseparates increasing precedence groups.  EXPRESSION may be:\n\n  ARG1 | ARG2       ARG1 if it is neither null nor 0, otherwise ARG2\n\n  ARG1 & ARG2       ARG1 if neither argument is null or 0, otherwise 0\n\n  ARG1 < ARG2       ARG1 is less than ARG2\n  ARG1 <= ARG2      ARG1 is less than or equal to ARG2\n  ARG1 = ARG2       ARG1 is equal to ARG2\n  ARG1 != ARG2      ARG1 is unequal to ARG2\n  ARG1 >= ARG2      ARG1 is greater than or equal to ARG2\n  ARG1 > ARG2       ARG1 is greater than ARG2\n\n  ARG1 + ARG2       arithmetic sum of ARG1 and ARG2\n  ARG1 - ARG2       arithmetic difference of ARG1 and ARG2\n\n  ARG1 * ARG2       arithmetic product of ARG1 and ARG2\n  ARG1 / ARG2       arithmetic quotient of ARG1 divided by ARG2\n  ARG1 % ARG2       arithmetic remainder of ARG1 divided by ARG2\n\n  STRING : REGEXP   anchored pattern match of REGEXP in STRING\n\n  match STRING REGEXP        same as STRING : REGEXP\n  substr STRING POS LENGTH   substring of STRING, POS counted from 1\n  index STRING CHARS         index in STRING where any CHARS is found, or 0\n  length STRING              length of STRING\n  + TOKEN                    interpret TOKEN as a string, even if it is a\n                               keyword like 'match' or an operator like '/'\n\n  ( EXPRESSION )             value of EXPRESSION\n\nBeware that many operators need to be escaped or quoted for shells.\nComparisons are arithmetic if both ARGs are numbers, else lexicographical.\nPattern matches return the string matched between \\( and \\) or null; if\n\\( and \\) are not used, they return the number of characters matched or 0.\n\nExit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null\nor 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.\n\nGNU coreutils online help: <http://www.gnu.org/software/coreutils/>\nFull documentation at: <http://www.gnu.org/software/coreutils/expr>\nor available locally via: info '(coreutils) expr invocation'\n")253  def testKeyword2(self):254    myTest = Expression('--version'.split())255    self.assertEqual(myTest.executeTest(),"expr (GNU coreutils) 8.24.32-c7af0\nCopyright (C) 2015 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n\nWritten by Mike Parker, James Youngman, and Paul Eggert.\n")256  def testKeyword3(self):257	myTest = Expression("match Gary Ga".split())258	self.assertEqual(myTest.executeTest(),'2\n')259  def testKeyword4(self):260	myTest = Expression("substr Elizabeth 4 8".split())261	self.assertEqual(myTest.executeTest(),'zabeth\n')262  def testKeyword5(self):263	myTest = Expression("length telephoneequipment".split())264	self.assertEqual(myTest.executeTest(),'18\n')265  def testKeyword6(self):266	myTest = Expression("--".split())267	self.assertEqual(myTest.executeTest(),'')268  def testKeyword7(self):269	myTest = Expression("a z".split())270	self.assertEqual(myTest.executeTest(),'')271  def testKeyword8(self):272	myTest = Expression("-- a".split())273	self.assertEqual(myTest.executeTest(),'a\n')274  def testKeyword9(self):275	myTest = Expression("7575 : 7575".split())276	self.assertEqual(myTest.executeTest(),'4\n')277  def testKeyword10(self):278	myTest = Expression("index index a".split())279	self.assertEqual(myTest.executeTest(),'')280  def testKeyword11(self):281	myTest = Expression("index + index a".split())282	self.assertEqual(myTest.executeTest(),'0\n')283  def testKeyword12(self):284	myTest = Expression("index 123456789 9".split())285	self.assertEqual(myTest.executeTest(),'9\n')286  def testRegex1(self):287	myTest = Expression("hello : hell".split())288	self.assertEqual(myTest.executeTest(),'4\n')289  def testRegex2(self):290	myTest = Expression("+ index : ind".split())291	self.assertEqual(myTest.executeTest(),'3\n')292  def testRegex3(self):293	myTest = Expression("aaa : a\+".split())294	self.assertEqual(myTest.executeTest(),'3\n')295  def testRegex4(self):296	myTest = Expression("abc : a\(.\)c".split())297	self.assertEqual(myTest.executeTest(),'b\n')298class Expression:  299  def __init__(self, arguments):300    self.args  = ['../coreutils/src/./expr'] # CoreUtils' expr301    #self.args  = ['expr'] # BSD's expr302    for item in arguments:303        self.args.append(item)304  def exp(self):305    return self.args306  def evauluateExpression(self):307	ps         = Popen(self.exp(), stdout=PIPE, stderr=PIPE)308	(out, err) = ps.communicate()309	exit_code  = ps.wait()310	return out311  def executeTest(self):312    self.out = self.evauluateExpression()313    return self.out314if __name__ == '__main__':...ClassOfTests.py
Source:ClassOfTests.py  
1<<<<<<< HEAD2from selenium import webdriver3from selenium.webdriver.common.by import By4from selenium.webdriver.common.keys import Keys5from selenium.webdriver.support.ui import Select6from selenium.common.exceptions import NoSuchElementException7from selenium.common.exceptions import NoAlertPresentException8import time, datetime, csv, logging9import unittest10#new comments abcde11#extr comment adfsdfdf12class AllTests(object):13    def __init__(self, driver):14        self.driver = driver15    def Test1(self):16        print ("Test1 running now")17        driver = webdriver.Chrome()18        from POM import PageObjects19        mytest = PageObjects(driver)20        PageObjects.FileToWriteTo = 'JobServeTest1'21        DateTime = datetime.datetime.now()22        line = str(DateTime)23        line1 = line.translate(None, ' :.')24        LOG_FILENAME = 'JobServeTest1_' + line1 + '.log'25        logging.basicConfig(filename=LOG_FILENAME, level=logging.INFO)26        with open('C:\Users\lw\PycharmProjects\FirstSeleniumTest\Test\users.csv') as csvfile:27            readCSV = csv.reader(csvfile, delimiter=',')28            for row in readCSV:29                print(row)30                username = (row[0])31                password = (row[1])32                logging.info("=====================================================================================")33                logging.info("TEST CASE FOR USER: " + username + "   Date: " + line)34                logging.info("=====================================================================================")35                mytest.WriteToFile(36                    '=====================================================================================' + '\n')37                mytest.WriteToFile('TEST CASE FOR USER: ' + username + '     Date: ' + line + '\n')38                mytest.WriteToFile(39                    '=====================================================================================' + '\n')40                mytest.HomePage_NavigateTo()41                mytest.HomePage_SignIn_Click()42                if (mytest.Check_For_Text_In_Page('Allow cookies')):43                    mytest.Login_Cookies_Click()44                mytest.Login_UserName_EnterText(username)45                mytest.Login_Password_EnterText(password)46                mytest.Login_Submit_Click()47                time.sleep(10)48                mytest.Check_For_Text_In_Page('xMy Profile')49                mytest.HomePage_WithinDaysDDL_Select('Within 4 days')50                mytest.HomePage_ViewProfile_Click()51                mytest.Check_For_Text_In_Page('xActively Seeking')52                mytest.MyProfile_HomeLocation_VerifyAttr('Woking, Surrey')53                mytest.MyProfile_PrintIcon_isElementPresent()54                mytest.MyProfile_PrintIcon_isElementVisible('True')55                mytest.MyProfile_Availablity_VerifyElementText('xxxImmediate')56                mytest.TopMenu_HomeIcon_Click()57                mytest.HomePage_CountriesCheckBox_isChecked('True')58                time.sleep(10)59                mytest.HomePage_LogOut_Click()60                time.sleep(10)61        driver.quit()62    def Test2(self):63        print ("Test2 running now")64        driver = webdriver.Chrome()65        from POM import PageObjects66        mytest = PageObjects(driver)67        PageObjects.FileToWriteTo = 'JobServeTest2'68        DateTime = datetime.datetime.now()69        line = str(DateTime)70        line1 = line.translate(None, ' :.')71        LOG_FILENAME = 'JobServeTest1_' + line1 + '.log'72        logging.basicConfig(filename=LOG_FILENAME, level=logging.INFO)73        with open('C:\Users\lw\PycharmProjects\FirstSeleniumTest\Test\users.csv') as csvfile:74            readCSV = csv.reader(csvfile, delimiter=',')75            for row in readCSV:76                print(row)77                username = (row[0])78                password = (row[1])79                logging.info("=====================================================================================")80                logging.info("TEST CASE FOR USER: " + username + "   Date: " + line)81                logging.info("=====================================================================================")82                mytest.WriteToFile(83                    '=====================================================================================' + '\n')84                mytest.WriteToFile('TEST CASE FOR USER: ' + username + '     Date: ' + line + '\n')85                mytest.WriteToFile(86                    '=====================================================================================' + '\n')87                mytest.HomePage_NavigateTo()88                mytest.HomePage_SignIn_Click()89                if (mytest.Check_For_Text_In_Page('Allow cookies')):90                    mytest.Login_Cookies_Click()91                mytest.Login_UserName_EnterText(username)92                mytest.Login_Password_EnterText(password)93                mytest.Login_Submit_Click()94                time.sleep(10)95                mytest.Check_For_Text_In_Page('xMy Profile')96                mytest.HomePage_WithinDaysDDL_Select('Within 4 days')97                mytest.HomePage_ViewProfile_Click()98                mytest.Check_For_Text_In_Page('xActively Seeking')99                mytest.MyProfile_HomeLocation_VerifyAttr('Woking, Surrey')100                mytest.MyProfile_PrintIcon_isElementPresent()101                mytest.MyProfile_PrintIcon_isElementVisible('True')102                mytest.MyProfile_Availablity_VerifyElementText('xxxImmediate')103                mytest.TopMenu_HomeIcon_Click()104                mytest.HomePage_CountriesCheckBox_isChecked('True')105                time.sleep(10)106                mytest.HomePage_LogOut_Click()107                time.sleep(10)108        driver.quit()109    def Test3(self):110        print ("Test3 running now")111=======112from selenium import webdriver113from selenium.webdriver.common.by import By114from selenium.webdriver.common.keys import Keys115from selenium.webdriver.support.ui import Select116from selenium.common.exceptions import NoSuchElementException117from selenium.common.exceptions import NoAlertPresentException118import time, datetime, csv, logging119import unittest120class AllTests(object):121    def __init__(self, driver):122        self.driver = driver123    def Test1(self):124        print ("Test1 running now")125        driver = webdriver.Chrome()126        from POM import PageObjects127        mytest = PageObjects(driver)128        PageObjects.FileToWriteTo = 'JobServeTest1'129        DateTime = datetime.datetime.now()130        line = str(DateTime)131        line1 = line.translate(None, ' :.')132        LOG_FILENAME = 'JobServeTest1_' + line1 + '.log'133        logging.basicConfig(filename=LOG_FILENAME, level=logging.INFO)134        with open('C:\Users\lw\PycharmProjects\FirstSeleniumTest\Test\users.csv') as csvfile:135            readCSV = csv.reader(csvfile, delimiter=',')136            for row in readCSV:137                print(row)138                username = (row[0])139                password = (row[1])140                logging.info("=====================================================================================")141                logging.info("TEST CASE FOR USER: " + username + "   Date: " + line)142                logging.info("=====================================================================================")143                mytest.WriteToFile(144                    '=====================================================================================' + '\n')145                mytest.WriteToFile('TEST CASE FOR USER: ' + username + '     Date: ' + line + '\n')146                mytest.WriteToFile(147                    '=====================================================================================' + '\n')148                mytest.HomePage_NavigateTo()149                mytest.HomePage_SignIn_Click()150                if (mytest.Check_For_Text_In_Page('Allow cookies')):151                    mytest.Login_Cookies_Click()152                mytest.Login_UserName_EnterText(username)153                mytest.Login_Password_EnterText(password)154                mytest.Login_Submit_Click()155                time.sleep(10)156                mytest.Check_For_Text_In_Page('xMy Profile')157                mytest.HomePage_WithinDaysDDL_Select('Within 4 days')158                mytest.HomePage_ViewProfile_Click()159                mytest.Check_For_Text_In_Page('xActively Seeking')160                mytest.MyProfile_HomeLocation_VerifyAttr('Woking, Surrey')161                mytest.MyProfile_PrintIcon_isElementPresent()162                mytest.MyProfile_PrintIcon_isElementVisible('True')163                mytest.MyProfile_Availablity_VerifyElementText('xxxImmediate')164                mytest.TopMenu_HomeIcon_Click()165                mytest.HomePage_CountriesCheckBox_isChecked('True')166                time.sleep(10)167                mytest.HomePage_LogOut_Click()168                time.sleep(10)169        driver.quit()170    def Test2(self):171        print ("Test2 running now")172        driver = webdriver.Chrome()173        from POM import PageObjects174        mytest = PageObjects(driver)175        PageObjects.FileToWriteTo = 'JobServeTest2'176        DateTime = datetime.datetime.now()177        line = str(DateTime)178        line1 = line.translate(None, ' :.')179        LOG_FILENAME = 'JobServeTest1_' + line1 + '.log'180        logging.basicConfig(filename=LOG_FILENAME, level=logging.INFO)181        with open('C:\Users\lw\PycharmProjects\FirstSeleniumTest\Test\users.csv') as csvfile:182            readCSV = csv.reader(csvfile, delimiter=',')183            for row in readCSV:184                print(row)185                username = (row[0])186                password = (row[1])187                logging.info("=====================================================================================")188                logging.info("TEST CASE FOR USER: " + username + "   Date: " + line)189                logging.info("=====================================================================================")190                mytest.WriteToFile(191                    '=====================================================================================' + '\n')192                mytest.WriteToFile('TEST CASE FOR USER: ' + username + '     Date: ' + line + '\n')193                mytest.WriteToFile(194                    '=====================================================================================' + '\n')195                mytest.HomePage_NavigateTo()196                mytest.HomePage_SignIn_Click()197                if (mytest.Check_For_Text_In_Page('Allow cookies')):198                    mytest.Login_Cookies_Click()199                mytest.Login_UserName_EnterText(username)200                mytest.Login_Password_EnterText(password)201                mytest.Login_Submit_Click()202                time.sleep(10)203                mytest.Check_For_Text_In_Page('xMy Profile')204                mytest.HomePage_WithinDaysDDL_Select('Within 4 days')205                mytest.HomePage_ViewProfile_Click()206                mytest.Check_For_Text_In_Page('xActively Seeking')207                mytest.MyProfile_HomeLocation_VerifyAttr('Woking, Surrey')208                mytest.MyProfile_PrintIcon_isElementPresent()209                mytest.MyProfile_PrintIcon_isElementVisible('True')210                mytest.MyProfile_Availablity_VerifyElementText('xxxImmediate')211                mytest.TopMenu_HomeIcon_Click()212                mytest.HomePage_CountriesCheckBox_isChecked('True')213                time.sleep(10)214                mytest.HomePage_LogOut_Click()215                time.sleep(10)216        driver.quit()217    def Test3(self):218        print ("Test3 running now")...config.py
Source:config.py  
1from pathlib import Path23from hase.path import APP_ROOT45# SPEC_PATH = APP_ROOT.joinpath("..", "spec").resolve()6SPEC_PATH = Path("/home") / "harveylu" / "cpu2017"78SUITE_PATH = str(SPEC_PATH.joinpath("benchspec", "CPU")) + "/"910# RUN_PATH = '/run/run_base_test_mytest-m64.0000/'11RUN_PATH = "/run/run_base_refspeed_mytest-m64.0000/"1213USAGE = str(APP_ROOT.joinpath("rusage.csv"))1415INT_SPEED = ["600", "602", "605", "620", "623", "625", "631", "641", "648", "657"]16FLOAT_SPEED = ["603", "607", "619", "621", "627", "628", "638", "644", "649", "654"]1718SUITE = {19    "600": {20        "commands": [21            "../run_base_test_mytest-m64.0000/perlbench_s_base.mytest-m64 "22            "-I. -I./lib makerand.pl > makerand.out 2>> makerand.err",23            "../run_base_test_mytest-m64.0000/perlbench_s_base.mytest-m64 "24            "-I. -I./lib test.pl > test.out 2>> test.err",25        ],26        "name": "600.perlbench_s",27    },28    "602": {"commands": [], "name": "602.gcc_s"},29    "603": {30        "commands": [31            "../run_base_test_mytest-m64.0000/speed_bwaves_base.mytest-m64 "32            "bwaves_1 < bwaves_1.in > bwaves_1.out 2>> bwaves_1.err",33            "../run_base_test_mytest-m64.0000/speed_bwaves_base.mytest-m64 "34            "bwaves_2 < bwaves_2.in > bwaves_2.out 2>> bwaves_2.err",35        ],36        "name": "603.bwaves_s",37    },38    "605": {39        "commands": [40            "../run_base_test_mytest-m64.0000/mcf_s_base.mytest-m64 "41            "inp.in  > inp.out 2>> inp.err"42        ],43        "name": "605.mcf_s",44    },45    "607": {46        "commands": [47            "../run_base_test_mytest-m64.0000/cactuBSSN_s_base.mytest-m64 "48            "spec_test.par   > spec_test.out 2>> spec_test.err"49        ],50        "name": "607.cactuBSSN_s",51    },52    "619": {53        "commands": [54            "../run_base_test_mytest-m64.0000/lbm_s_base.mytest-m64 "55            "20 reference.dat 0 1 200_200_260_ldc.of > lbm.out 2>> "56            "lbm.err"57        ],58        "name": "619.lbm_s",59    },60    "620": {61        "commands": [62            "../run_base_test_mytest-m64.0000/omnetpp_s_base.mytest-m64 "63            "-c General -r 0 > omnetpp.General-0.out 2>> "64            "omnetpp.General-0.err"65        ],66        "name": "620.omnetpp_s",67    },68    "621": {69        "commands": [70            "../run_base_test_mytest-m64.0000/wrf_s_base.mytest-m64 "71            "> rsl.out.0000 2>> wrf.err"72        ],73        "name": "621.wrf_s",74    },75    "623": {76        "commands": [77            "../run_base_test_mytest-m64.0000/xalancbmk_s_base.mytest-m64 "78            "-v test.xml xalanc.xsl > test-test.out 2>> "79            "test-test.err"80        ],81        "name": "623.xalancbmk_s",82    },83    "625": {84        "commands": [85            "../run_base_test_mytest-m64.0000/x264_s_base.mytest-m64 "86            "--dumpyuv 50 --frames 156 -o BuckBunny_New.264 "87            "BuckBunny.yuv 1280x720 > "88            "run_000-156_x264_s_base.mytest-m64_x264.out 2>> "89            "run_000-156_x264_s_base.mytest-m64_x264.err"90        ],91        "name": "625.x264_s",92    },93    "627": {94        "commands": [95            "../run_base_test_mytest-m64.0000/cam4_s_base.mytest-m64 "96            "> cam4_s_base.mytest-m64.txt 2>> "97            "cam4_s_base.mytest-m64.err"98        ],99        "name": "627.cam4_s",100    },101    "628": {102        "commands": [103            "../run_base_test_mytest-m64.0000/speed_pop2_base.mytest-m64 "104            "> pop2_s.out 2>> pop2_s.err"105        ],106        "name": "628.pop2_s",107    },108    "631": {109        "commands": [110            "../run_base_test_mytest-m64.0000/deepsjeng_s_base.mytest-m64 "111            "test.txt > test.out 2>> test.err"112        ],113        "name": "631.deepsjeng_s",114    },115    "638": {116        "commands": [117            "../run_base_test_mytest-m64.0000/imagick_s_base.mytest-m64 "118            "-limit disk 0 test_input.tga -shear 25 -resize 640x480 "119            "-negate -alpha Off test_output.tga > test_convert.out "120            "2>> test_convert.err"121        ],122        "name": "638.imagick_s",123    },124    "641": {125        "commands": [126            "../run_b ase_test_mytest-m64.0000/leela_s_base.mytest-m64 "127            "test.sgf > test.out 2>> test.err"128        ],129        "name": "641.leela_s",130    },131    "644": {132        "commands": [133            "../run_base_test_mytest-m64.0000/nab_s_base.mytest-m64 "134            "hkrdenq 1930344093 1000 > hkrdenq.out 2>> hkrdenq.err"135        ],136        "name": "644.nab_s",137    },138    "648": {139        "commands": [140            "../run_base_test_mytest-m64.0000/exchange2_s_base.mytest-m64 "141            "0 > exchange2.txt 2>> exchange2.err"142        ],143        "name": "648.exchange2_s",144    },145    "649": {146        "commands": [147            "../run_base_test_mytest-m64.0000/fotonik3d_s_base.mytest-m64 "148            "> fotonik3d_s.log 2>> fotonik3d_s.err"149        ],150        "name": "649.fotonik3d_s",151    },152    "654": {153        "commands": [154            "../run_base_test_mytest-m64.0000/sroms_base.mytest-m64 "155            "< ocean_benchmark0.in > ocean_benchmark0.log 2>> "156            "ocean_benchmark0.err"157        ],158        "name": "654.roms_s",159    },160    "657": {161        "commands": [162            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "163            "cpu2006docs.tar.xz 4 "164            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "165            "1548636 1555348 0 > cpu2006docs.tar-4-0.out 2>> "166            "cpu2006docs.tar-4-0.err",167            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "168            "cpu2006docs.tar.xz 4 "169            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "170            "1462248 -1 1 > cpu2006docs.tar-4-1.out 2>> "171            "cpu2006docs.tar-4-1.err",172            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "173            "cpu2006docs.tar.xz 4 "174            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "175            "1428548 -1 2 > cpu2006docs.tar-4-2.out 2>> "176            "cpu2006docs.tar-4-2.err",177            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "178            "cpu2006docs.tar.xz 4 "179            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "180            "1034828 -1 3e > cpu2006docs.tar-4-3e.out 2>> "181            "cpu2006docs.tar-4-3e.err",182            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "183            "cpu2006docs.tar.xz 4 "184            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "185            "1061968 -1 4 > cpu2006docs.tar-4-4.out 2>> "186            "cpu2006docs.tar-4-4.err",187            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "188            "cpu2006docs.tar.xz 4 "189            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "190            "1034588 -1 4e > cpu2006docs.tar-4-4e.out 2>> "191            "cpu2006docs.tar-4-4e.err",192            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "193            "cpu2006docs.tar.xz 1 "194            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "195            "650156 -1 0 > cpu2006docs.tar-1-0.out 2>> "196            "cpu2006docs.tar-1-0.err",197            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "198            "cpu2006docs.tar.xz 1 "199            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "200            "639996 -1 1 > cpu2006docs.tar-1-1.out 2>> "201            "cpu2006docs.tar-1-1.err",202            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "203            "cpu2006docs.tar.xz 1 "204            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "205            "637616 -1 2 > cpu2006docs.tar-1-2.out 2>> "206            "cpu2006docs.tar-1-2.err",207            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "208            "cpu2006docs.tar.xz 1 "209            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "210            "628996 -1 3e > cpu2006docs.tar-1-3e.out 2>> "211            "cpu2006docs.tar-1-3e.err",212            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "213            "cpu2006docs.tar.xz 1 "214            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "215            "631912 -1 4 > cpu2006docs.tar-1-4.out 2>> "216            "cpu2006docs.tar-1-4.err",217            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 "218            "cpu2006docs.tar.xz 1 "219            "055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae "220            "629064 -1 4e > cpu2006docs.tar-1-4e.out 2>> "221            "cpu2006docs.tar-1-4e.err",222        ],223        "name": "657.xz_s",224    },
...suite.py
Source:suite.py  
1{2    "600": {3        "name": "600.perlbench_s",4        "commands": [5            "../run_base_test_mytest-m64.0000/perlbench_s_base.mytest-m64 -I. -I./lib makerand.pl > makerand.out 2>> makerand.err",6            "../run_base_test_mytest-m64.0000/perlbench_s_base.mytest-m64 -I. -I./lib test.pl > test.out 2>> test.err",7        ],8    },9    "602": {"name": "602.gcc_s", "commands": []},10    "605": {11        "name": "605.mcf_s",12        "commands": [13            "../run_base_test_mytest-m64.0000/mcf_s_base.mytest-m64 inp.in  > inp.out 2>> inp.err"14        ],15    },16    "620": {17        "name": "620.omnetpp_s",18        "commands": [19            "../run_base_test_mytest-m64.0000/omnetpp_s_base.mytest-m64 -c General -r 0 > omnetpp.General-0.out 2>> omnetpp.General-0.err"20        ],21    },22    "623": {23        "name": "623.xalancbmk_s",24        "commands": [25            "../run_base_test_mytest-m64.0000/xalancbmk_s_base.mytest-m64 -v test.xml xalanc.xsl > test-test.out 2>> test-test.err"26        ],27    },28    "625": {29        "name": "625.x264_s",30        "commands": [31            "../run_base_test_mytest-m64.0000/x264_s_base.mytest-m64 --dumpyuv 50 --frames 156 -o BuckBunny_New.264 BuckBunny.yuv 1280x720 > run_000-156_x264_s_base.mytest-m64_x264.out 2>> run_000-156_x264_s_base.mytest-m64_x264.err"32        ],33    },34    "631": {35        "name": "631.deepsjeng_s",36        "commands": [37            "../run_base_test_mytest-m64.0000/deepsjeng_s_base.mytest-m64 test.txt > test.out 2>> test.err"38        ],39    },40    "641": {41        "name": "641.leela_s",42        "commands": [43            "../run_base_test_mytest-m64.0000/leela_s_base.mytest-m64 test.sgf > test.out 2>> test.err"44        ],45    },46    "648": {47        "name": "648.exchange2_s",48        "commands": [49            "../run_base_test_mytest-m64.0000/exchange2_s_base.mytest-m64 0 > exchange2.txt 2>> exchange2.err"50        ],51    },52    "657": {53        "name": "657.xz_s",54        "commands": [55            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1548636 1555348 0 > cpu2006docs.tar-4-0.out 2>> cpu2006docs.tar-4-0.err",56            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1462248 -1 1 > cpu2006docs.tar-4-1.out 2>> cpu2006docs.tar-4-1.err",57            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1428548 -1 2 > cpu2006docs.tar-4-2.out 2>> cpu2006docs.tar-4-2.err",58            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1034828 -1 3e > cpu2006docs.tar-4-3e.out 2>> cpu2006docs.tar-4-3e.err",59            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1061968 -1 4 > cpu2006docs.tar-4-4.out 2>> cpu2006docs.tar-4-4.err",60            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 4 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 1034588 -1 4e > cpu2006docs.tar-4-4e.out 2>> cpu2006docs.tar-4-4e.err",61            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 650156 -1 0 > cpu2006docs.tar-1-0.out 2>> cpu2006docs.tar-1-0.err",62            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 639996 -1 1 > cpu2006docs.tar-1-1.out 2>> cpu2006docs.tar-1-1.err",63            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 637616 -1 2 > cpu2006docs.tar-1-2.out 2>> cpu2006docs.tar-1-2.err",64            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 628996 -1 3e > cpu2006docs.tar-1-3e.out 2>> cpu2006docs.tar-1-3e.err",65            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 631912 -1 4 > cpu2006docs.tar-1-4.out 2>> cpu2006docs.tar-1-4.err",66            "../run_base_test_mytest-m64.0000/xz_s_base.mytest-m64 cpu2006docs.tar.xz 1 055ce243071129412e9dd0b3b69a21654033a9b723d874b2015c774fac1553d9713be561ca86f74e4f16f22e664fc17a79f30caa5ad2c04fbc447549c2810fae 629064 -1 4e > cpu2006docs.tar-1-4e.out 2>> cpu2006docs.tar-1-4e.err",67        ],68    },69    "603": {70        "name": "603.bwaves_s",71        "commands": [72            "../run_base_test_mytest-m64.0000/speed_bwaves_base.mytest-m64 bwaves_1 < bwaves_1.in > bwaves_1.out 2>> bwaves_1.err",73            "../run_base_test_mytest-m64.0000/speed_bwaves_base.mytest-m64 bwaves_2 < bwaves_2.in > bwaves_2.out 2>> bwaves_2.err",74        ],75    },76    "607": {77        "name": "607.cactuBSSN_s",78        "commands": [79            "../run_base_test_mytest-m64.0000/cactuBSSN_s_base.mytest-m64 spec_test.par   > spec_test.out 2>> spec_test.err"80        ],81    },82    "619": {83        "name": "619.lbm_s",84        "commands": [85            "../run_base_test_mytest-m64.0000/lbm_s_base.mytest-m64 20 reference.dat 0 1 200_200_260_ldc.of > lbm.out 2>> lbm.err"86        ],87    },88    "621": {89        "name": "621.wrf_s",90        "commands": [91            "../run_base_test_mytest-m64.0000/wrf_s_base.mytest-m64 > rsl.out.0000 2>> wrf.err"92        ],93    },94    "627": {95        "name": "627.cam4_s",96        "commands": [97            "../run_base_test_mytest-m64.0000/cam4_s_base.mytest-m64 > cam4_s_base.mytest-m64.txt 2>> cam4_s_base.mytest-m64.err"98        ],99    },100    "628": {101        "name": "628.pop2_s",102        "commands": [103            "../run_base_test_mytest-m64.0000/speed_pop2_base.mytest-m64 > pop2_s.out 2>> pop2_s.err"104        ],105    },106    "638": {107        "name": "638.imagick_s",108        "commands": [109            "../run_base_test_mytest-m64.0000/imagick_s_base.mytest-m64 -limit disk 0 test_input.tga -shear 25 -resize 640x480 -negate -alpha Off test_output.tga > test_convert.out 2>> test_convert.err"110        ],111    },112    "644": {113        "name": "644.nab_s",114        "commands": [115            "../run_base_test_mytest-m64.0000/nab_s_base.mytest-m64 hkrdenq 1930344093 1000 > hkrdenq.out 2>> hkrdenq.err"116        ],117    },118    "649": {119        "name": "649.fotonik3d_s",120        "commands": [121            "../run_base_test_mytest-m64.0000/fotonik3d_s_base.mytest-m64 > fotonik3d_s.log 2>> fotonik3d_s.err"122        ],123    },124    "654": {125        "name": "654.roms_s",126        "commands": [127            "../run_base_test_mytest-m64.0000/sroms_base.mytest-m64 < ocean_benchmark0.in > ocean_benchmark0.log 2>> ocean_benchmark0.err"128        ],129    },...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
