Tag Info

Hot answers tagged

16

While it's not updated as regularly as it once was, Grig Gheorgiu's Python Testing Tools Taxonomy is considered by Pythonistas to be an excellent reference point for tools. It covers the following kinds of testing tools: Unit Testing Tools Mock Testing Tools Fuzz Testing Tools Web Testing Tools Acceptance/Business Logic Testing Tools GUI Testing Tools ...


14

I think using selenium.webdriver.support.ui.Select is the cleanest way: from selenium import webdriver from selenium.webdriver.support.ui import Select b = webdriver.Firefox() # navigate to the page select = Select(b.find_element_by_id(....)) print select.options print [o.text for o in select.options] # these are string-s select.select_by_visible_text(....) ...


10

The easiest way that I have found was to do something along the lines of: el = driver.find_element_by_id('id_of_select') for option in el.find_elements_by_tag_name('option'): if option.text == 'The Options I Am Looking For': option.click() # select() in earlier versions of webdriver This may have some runtime issues if there are a large number ...


8

All the learning starts from step1. You have learned based on your own interest. I had a lot of support from this community and stackoverflow when i started writing automated tools. I can share my experience. 5 Rules for beginners getting into test automation Rule#1 - Do not worry about design, error handling when you start writing your automation suite. ...


7

Yes, you're on the right path (though I have a caveat or two). More generally than "raise the right exception": The tactic is to make sure that no matter how SVN responds to your app's commands, your app responds as you wish. For me, the biggest challenges when mocking third-party code is to characterize: All the ways my code uses the third-party code ...


7

I'm going with my favorite response here: it depends. Sometimes the decision is made because that's the language the tool supports. Sometimes the language is a flavor of the language used by the development team - this often happens where there's an expectation that the development team will be writing at least some of the test automation code. Sometimes ...


6

Burp Suite would be worth checking out if you're fuzz testing web applications. As the name implies, it's actually a suite of different web security testing tools - I used it for the first time on Monday in a pen testing workshop and it seems like a tremendously useful tool. Burp Intruder is the tool used for fuzzing attacks - and here's a video tutorial ...


5

Do you need Selenium for this task? If you have an existing suite of Selenium tests, you can run them against the new site to verify the functionality is working, but in general Selenium is not the best tool for validating look and feel, or massive amounts of content. There are several link checker tools that will crawl all of the links and download all ...


4

I had only one experience of automation testing for Qt apps on Linux. The tool I used is Squish, and it supports Java, Web and Mobile testing as well. The test scripts are written in python. Just FYI. It's a commercial product, you need to buy the license.


4

checkboxes = self.browser.find_elements_by_xpath("//input[@name='arr[]']") for checkbox in checkboxes: if not checkbox.isSelected(): checkbox.click() (Previous answer): I am not yet familiar with the python syntax, but this is what you can do: Return all elements with the given xpath: ...


4

My experience with automation is that it's invaluable for regression, particularly the kinds of regression that are tedious and painstaking to perform. A login script is usually a utility that happens as part of a larger script suite - which must, as Siva said, be object-oriented and data-driven if you don't want to create yourself a maintenance nightmare. ...


4

I am the author. Actually this is a patch-like binding. You should know what I said in step 2. You need to download the source code of official Python bindings for Selenium and then copy my patch to the source files and install the patch source code, as mentioned in step 3 and 4.


3

There are times when using the Page Object Pattern makes a lot of sense and times where it doesn't make as much sense. If you have a web application where it is basically one single dynamic page then it makes less sense, however you can still use "page" objects that are really more like "section" objects for common pieces, for example if you have a Left ...


3

Nose supports parametric/generative tests, http://readthedocs.org/docs/nose/en/latest/writing_tests.html#test-generators For example: def checker(combination): # do something to verify the combination assert 'A' in combination def test_generator(): options = ['A', 'B', 'C'] for o in options: yield checker, o for p in ...


3

The simplest option is to just mark the line as ignored by your coverage tests. You know more than coverage.py does, you can just excuse the line from the measurements: if __name__ == '__main__': # pragma: no cover return main(sys.argv) You can also use some tricks with coverage.py to get it to measure code in launched subprocesses. This sounds ...


3

I think what you are looking for is the SSH plugin for Hudson: http://wiki.hudson-ci.org/display/HUDSON/SSH+plugin It let you run a shellscript before and/or after your build. That's the best fit, in my opinion. But you can execute a shellscript on the Hudson server using the Post Build task plugin: ...


3

I suspect Powershell's design center is tight integration with Windows services. Python is probably less tightly integrated with Windows, but may have a more substantial set of libraries, e.g. NumPy and SciPy for manipulating numeric data. An indication of its popularity is that a lot of college programming classes taught with Python now; I don't know how ...


3

Welcome to the club, Praveen; your problem is a rite of passage for Selenium users. Instead of trying to automate the file dialog, you may have better luck issuing the same HTTP request that your file upload form would have issued. Issuing a POST request for a file upload is a little bit harder than a GET request because of the encoding issues, but I ...


3

It seems you may not be accustomed to piping. No worries, it was new to everyone at some point. By using the shell to call your tests, you're mostly there already. A key thing here is that anything that get's written to your terminal can be "piped" into a file that you name. If you are seeing those results in your terminal, then you can route them to a ...


2

Similar to Will's answer, but finds the <select> by its element name, and clicks based on the <option> text. from selenium import webdriver b = webdriver.Firefox() b.find_element_by_xpath("//select[@name='element_name']/option[text()='option_text']").click()


2

I haven't used it myself (although I plan to on my side-project when I get it to private alpha stage) but I think Hexawise would be able to do some of this. You can tweak the phasing parameters (2 pairwise, 3 pairwise, I think it goes up to 6) and it will generate values in certain ranges. This should be pretty close to what you're looking to do. You can ...


2

As it happens, that isn't (as far as I can tell) the official documentation, which is here: http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html (And which does have the full API reference.)


2

You can launch each of your test jobs as a separate job with the Jenkins CI server. Jenkins can render a HTML report for each of your JUnit .xml test results that are generated. I'd say that is the quickest/easiest way to do it. Obviously, if you are using Py.Test or Nose, you will get this sort of output. If you don't use that method , then you ...


2

I wonder if it would be faster to use Xpaths to search specifically for cells in the row of interest, rather than fetching all rows and then manipulating the one row you are interested in. I am not fluent in Python, so I will illustrate my suggestion in pseudo-code: for i in 1..51 condition_xpath = "//table/tr[" + i + "]/td[1]" column1 = ...


2

I haven't used the Python bindings, but as far as I know they should be equivalent to the Java ones. If I were you I would try to find the Python equivalents of findElements() and isDisplayed() that are available in the Java bindings. For example, I would do something similar to this: // ... myElementList = driver.findElements(By.Id("fancybox-close")) if ...


2

Here's another example much like the one from Ignacio, but in C#: //Displayed public static bool IsElementDisplayed(this IWebDriver driver, By element) { if (driver.FindElements(element).Count > 0) { if (driver.FindElement(element).Displayed) return true; else return ...


2

Use XPATH. Install a tool like FirePath to help yourself debug this, but you'll probably want something like: select_finder = "//tr[contains(text(), 'Mahmoud')]//a" driver.find_element_by_xpath(select_finder).click() where the XPATH reads something like "find a table row which contains the text "Mahmoud", then find a hyperlink inside that row"


2

The resources available online for Python are more numerous than those for PowerShell. This can be a significant factor. On stackoverflow, the number of questions for python and powershell (at time of this writing): python : 215,177 powershell : 11,690


2

I think this is a general Python programming question rather than a test question. As a general programming practice, it is a good idea to give a constant a name, especially if the constant is used more than once. How you manage those names depends on your goal. You might do this: XPATH = "xpath" CSS = "css" SELECTOR_TYPE = "selectorType" SELECTOR = ...


1

Yes, there is another way. I call it “workarounds” Ingredients: 1. In the separate file, define all bug numbers as contestants cont int BUG_48484 = 48484 cont int BUG_5555 = 5555 2. Create a dictionary/hash with bug names and descriptions MyBugList = ( *# Commented: BUG_48484 => “Application crashes”,* BUG_5555 => “The Large Hadron Collider ...



Only top voted, non community-wiki answers of a minimum length are eligible