Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71776
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <sunitha_byju@hotmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'automate': 0.07; 'notice,': 0.07; 'subject:query': 0.07; 'subject:two': 0.07; 'subject:help': 0.08; '-multiple': 0.09; 'received:65.55.34.11': 0.09; 'subject:test': 0.09; 'def': 0.12; 'code?': 0.16; 'different,': 0.16; 'elem': 0.16; 'skip:d 60': 0.16; 'trying': 0.19; 'basically': 0.19; 'select': 0.22; 'to:name:python- list@python.org': 0.22; 'print': 0.22; 'driver': 0.24; 'skip:e 30': 0.24; 'order.': 0.26; 'query': 0.26; 'second': 0.26; 'skip:_ 20': 0.27; 'skip:( 40': 0.30; 'skip:( 20': 0.30; "i'm": 0.30; 'skip:q 20': 0.31; 'class': 0.32; 'run': 0.32; 'url:non-standard http port': 0.33; 'skip:d 20': 0.34; 'subject:with': 0.35; 'something': 0.35; 'test': 0.35; 'like,': 0.36; 'sequence': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'skip:o 30': 0.61; 'subject:Need': 0.64; 'submission': 0.64; 'different': 0.65; 'price': 0.69; 'verification': 0.83; 'received:65.55.34.7': 0.91 |
| X-TMN | [hcj6vUsYs6bzim4foOqyM6WRPqPOw5yh] |
| X-Originating-Email | [sunitha_byju@hotmail.com] |
| Content-Type | multipart/alternative; boundary="_4fa92ac4-ff40-4eb0-8957-c776a4556b55_" |
| From | Sunitha Byju <sunitha_byju@hotmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | Need help with executing DB query in two different places in a test |
| Date | Mon, 19 May 2014 16:46:44 -0400 |
| Importance | Normal |
| MIME-Version | 1.0 |
| X-OriginalArrivalTime | 19 May 2014 20:46:44.0819 (UTC) FILETIME=[7219CA30:01CF73A3] |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10142.1400532473.18130.python-list@python.org> (permalink) |
| Lines | 363 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1400532473 news.xs4all.nl 2962 [2001:888:2000:d::a6]:38154 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71776 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
I am trying to automate an ecom website. I need to run DB query after placing each order. I don't know how to run different queries after each order. Can someone help me out with having queries after each order submission or test?
If you notice, I'm calling self.database_verification() after test 1. So for the second test the query would be different, something like, Select * from PORTFOLIO_ORDER where MEMBER = 'USA' AND SYMBOL = 'TOP' OR SYMBOL = 'Sweater. Basically for the sequence of orders, i would have different queries. So what is the best way to write the code?
class OrderInputScreen(unittest.TestCase):
def setUp(self): self.driver = webdriver.Firefox() driver = self.driver driver.get("http://testserver:8080/OrderInputScreen/login#/") driver.maximize_window()
def database_verification(self): con = cx_Oracle.connect('user/user@testDB123') cur = con.cursor() cur.execute("Select * from US_ORDER where SYMBOL = 'TOP' and SIZE = 'M'") for result in cur: print result[2:8] cur.close() #USA single Order and verification
def __test_single_order(self): driver = self.driver elem = driver.find_element_by_name("username") elem.send_keys("TEST") elemPassword = driver.find_element_by_name("password") elemPassword.send_keys("TEST") elem.submit() member = driver.find_element_by_xpath("//form/div/dl/dd[1]/input") member.click() member.send_keys("USA") PayType = driver.find_element_by_xpath ("//form/div/dl/dd[2]/input") PayType.click() PayType.send_keys("USD") clickPayType = driver.find_element_by_xpath ("//form/div/dl/dd/ul/li/a") clickPayType.click() Symbol = driver.find_element_by_xpath ("//form/div/dl/dd[3]/input") Symbol.click() Symbol.send_keys("TOP") Quantity = driver.find_element_by_name ("quantity") Quantity.click() Quantity.send_keys("10") Price = driver.find_element_by_name ("price") Price.click() Price.send_keys("56.99") Size = driver.find_element_by_xpath ("//form/div/dl/dd[6]/select/option[text()='M']") Size.click() SubmitButton = driver.find_element_by_xpath ("//form/div/dl/dd[11]/div[2]") SubmitButton.click() ActualOrderMsg = driver.find_element_by_xpath ("//span/p").text print ActualOrderMsg textPresent = driver.find_element_by_xpath ("//span/p[contains(text(), 'Successfuly added to processing!')]") self.database_verification()
#USA -multiple orders and verification
def test_Multiple_order(self): #Order0
driver = self.driver elem = driver.find_element_by_name("username") elem.send_keys("TEST") elemPassword = driver.find_element_by_name("password") elemPassword.send_keys("TEST") elem.submit() member = driver.find_element_by_xpath("//form/div/dl/dd[1]/input") member.click() member.send_keys("USA") PayType = driver.find_element_by_xpath ("//form/div/dl/dd[2]/input") PayType.click() PayType.send_keys("USD") clickPayType = driver.find_element_by_xpath ("//form/div/dl/dd/ul/li/a") clickPayType.click() Symbol = driver.find_element_by_xpath ("//form/div/dl/dd[3]/input") Symbol.click() Symbol.send_keys("TOP") Quantity = driver.find_element_by_name ("quantity") Quantity.click() Quantity.send_keys("1") Price = driver.find_element_by_name ("price") Price.click() Price.send_keys("16.99") Size = driver.find_element_by_xpath ("//form/div/dl/dd[6]/select/option[text()='S']") Size.click() SubmitButton = driver.find_element_by_xpath ("//form/div/dl/dd[11]/div[2]") SubmitButton.click() ActualOrderMsg = driver.find_element_by_xpath ("//span/p").text print ActualOrderMsg textPresent = driver.find_element_by_xpath ("//span/p[contains(text(), 'Successfuly added to processing!')]" #Order1 AddOrder1 = driver.find_element_by_xpath("//div/div[2]/form/div[2]/button[1]") AddOrder1.click() member = driver.find_element_by_xpath("//form/div/dl/dd[1]/input") member.click() member.send_keys("USA") PayType = driver.find_element_by_xpath ("//form/div/dl/dd[2]/input") PayType.click() PayType.send_keys("USD") clickPayType = driver.find_element_by_xpath ("//form/div/dl/dd/ul/li/a") clickPayType.click() Symbol = driver.find_element_by_xpath ("//form/div/dl/dd[3]/input") Symbol.click() Symbol.send_keys("Sweater") Quantity = driver.find_element_by_name ("quantity") Quantity.click() Quantity.send_keys("2") Price = driver.find_element_by_name ("price") Price.click() Price.send_keys("26.99") Size = driver.find_element_by_xpath ("//form/div/dl/dd[6]/select/option[text()='M']") Size.click() SubmitButton = driver.find_element_by_xpath ("//form/div/dl/dd[11]/div[2]") SubmitButton.click() ActualOrderMsg = driver.find_element_by_xpath ("//span/p").text print ActualOrderMsg textPresent = driver.find_element_by_xpath ("//span/p[contains(text(), 'Successfuly added to processing!')]" #Order2 AddOrder2 = driver.find_element_by_xpath("//div/div[2]/form/div[3]/button[1]") AddOrder2.click() member = driver.find_element_by_xpath("//form/div/dl/dd[1]/input") member.click() member.send_keys("USA") PayType = driver.find_element_by_xpath ("//form/div/dl/dd[2]/input") PayType.click() PayType.send_keys("USD") clickPayType = driver.find_element_by_xpath ("//form/div/dl/dd/ul/li/a") clickPayType.click() Symbol = driver.find_element_by_xpath ("//form/div/dl/dd[3]/input") Symbol.click() Symbol.send_keys("Sweater") Quantity = driver.find_element_by_name ("quantity") Quantity.click() Quantity.send_keys("1") Price = driver.find_element_by_name ("price") Price.click() Price.send_keys("26.99") Size = driver.find_element_by_xpath ("//form/div/dl/dd[6]/select/option[text()='S']") Size.click() SubmitButton = driver.find_element_by_xpath ("//form/div/dl/dd[11]/div[2]") SubmitButton.click() ActualOrderMsg = driver.find_element_by_xpath ("//span/p").text print ActualOrderMsg textPresent = driver.find_element_by_xpath ("//span/p[contains(text(), 'Successfuly added to processing!')]")
Thanks,SB
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Need help with executing DB query in two different places in a test Sunitha Byju <sunitha_byju@hotmail.com> - 2014-05-19 16:46 -0400 Re: Need help with executing DB query in two different places in a test Tim Roberts <timr@probo.com> - 2014-05-19 22:34 -0700
csiph-web