Tag Info

Hot answers tagged

9

Strictly speaking you don't need to know how databases work to work with any automation tool. But without an understanding of databases and the ability to query them, you block off a large source of extra information you can use for validation. Some examples: Your application takes a person's name and contact details and stores them in three tables (for ...


6

Selenium is a tool that remote-controls a browser. You can use it to simulate a user interacting with a web site. JUnit is a framework for writing Java unit tests. It takes some of the grunt work out of organizing tests and generating reports. You can express each test as a method on a class; typically, you have multiple tests per class. JUnit will run ...


4

In your comment you mentioned that the element is within a <frameset> \ <frame>. To work with any element within a frame, you need to first switch the context of the driver from the main page to that frame: driver.switchTo().frame("foo"); In this example "foo" would be the name of the iframe. You can also do it by index if the frame has no name ...


4

Not everyone on the team needs the same skills, and if you already have enough development capacity you might be more valuable for the overall results if you take up other tasks. When working together with testers in an automation project, developers can focus on the development part if there is someone else who: Really understands the application and the ...


4

If your using Java, here is the JavaDoc If your using Ruby, here is the Ruby Docs If your using Python, here is the Python Docs If your using .Net, here is the .Net docs This will contain all of the functions that Selenium uses.


3

Browsermob-proxy could be used to blacklist the GA hosts, so the code isn't even loaded. https://github.com/lightbody/browsermob-proxy It integrates well with Selenium. Here is a general purpose talk describing using BMP to blacklist cruft that can slow down automation (Facebook & Twitter widgets are specifically mentioned, but I'm sure GA can also ...


3

It's in git so you could do a sparse checkout to get the JavaDoc part of the repo only. This blog post about sparse checkouts goes through it in a reasonable amount of detail: http://blog.quilitz.de/2010/03/checkout-sub-directories-in-git-sparse-checkouts/comment-page-1/#comment-3146 Or you could download them from maven central: ...


3

Take the screenshot in the @After test tear down method, which is run after every test. This way you will always get a screenshot for both passed and failed tests. public class TestSample { static WebDriver driver; @Before public void setUp() { //start new webdriver session, for eg using firefox driver = new FirefoxDriver(); ...


3

I understand you have problems with test automation because you are not much skilled (yet) in programming. And it hurts. I believe the more something hurts, the more resistance something offers, the more you need to practice that until the moment things become a routine for you and you become more effective. There are no workarounds and shortcuts to master ...


3

Depending on your project you may also assert visual consistency, for example in a website that shows breadcrumbs the level of nesting should be consistent with the displayed breadcrumbs. Maybe a 'minimum width' for buttons/text inputs/etc. You may also probe performance and measure how fast is the site loading. Whether these are expected of you or not is ...


3

type void type(java.lang.String locator, java.lang.String value) Sets the value of an input field, as though you typed it in. Inputs the value. Sets the textfield to the value, nothing special. It just takes the entire string and puts it in there at one time. typeKeys void typeKeys(java.lang.String locator, java.lang.String value) ...


3

For testing it, your doing an extremely basic test. A major advantage of automation is that you can do a lot more testing. I would set up a datasource for names, declare them valid or invalid, and have it attempt to use it. I would also have it only use one of the special characters at a time and the rest be valid (As of now your essentially testing if any ...


2

As much as possible, please avoid using absolute xpaths, any small change in the page layouts and your xpaths may become completely useless, as much as possible, use the class names, ids etc... For the gmail sign-in, //div[@class='signin-box']//div[@class='email-div']//input[@id='Email'] is the xpath for the UserName Text field, likewise for the ...


2

As long as you make sure the element you want to click is actually ready, then it will work reliably. There are ways to find elements without throwing exceptions by using try-catch conditions inside of loops. For example, this method I wrote (which can be simplified depending on what you use if for) will return a WebElement and it makes sure that it's ...


2

TestNG knows nothing about assertions per se. It knows only that the test threw an exception or did not. All of the information that TestNG gets from the assertion comes from the exception thrown by the assertion failure. If an assertion passes, TestNG never knows about it. On the other hand, you can write your assertion methods that know how to log ...


2

I can tell you what I do in this situation. I have not used the LoadableComponent, however what I have done has followed a similar pattern. I create classes for each of the "loadable components" that are basically page objects. I have something like the IsLoaded function to ensure that the component is loaded, and depending on how it works I either don't ...


2

Geb runs WebDriver in the Groovy language. The goal is to make the use of WebDriver simpler. However, if you use WebDriver directly, it's supported in a number of languages, including Python, Ruby, C#, Java and implementations exist in others, including PHP, Perl and potentially Javascript. The support for PageObject and jQuery selection is existent in ...


2

If you can't determine why the browser won't launch, you can make your tests more robust. Make sure to clean the environment during test warmup, add some retry/wait/timeout wrappers around the section that launches the browser, and kill any processes and services that aren't relevant to the test. In order to find out why the browser is crashing, you can ...


2

A Sleep method is almost always the least acceptable way to synchronize an automated test. A better approach might be to register an event and check the event is raised when in the desired state, or use a polling loop which will can enable the test to proceed when the system is ready (e.g. an element id appears), or a timeout occurs if it takes more than a ...


2

What kind of hidden objects are you looking for? If it's any HTML tags with the attribute display: none; try using List<WebElement> elements = driver.findElements(By.cssSelector("[display=none]")); int count = elements.size(); This uses CSS matching to find all HTML elements with the display attribute equal to none. Then get the size of the returned ...


2

Typically HTML IDs are unique; if you know the ID, you do not need to know the element tag. Of course it is possible to write a web page that uses duplicate IDs. If your web page has duplicate IDs, you should complain to the developer. For the rest of my answer, I will assume unique IDs. According to this, XPath doesn't actually know anything about CSS ...


2

CSS selectors can also match strings that start with, end with, or contain a certain substring. For example input[id^="E_DOS_TITEL"] will match an input element whose id attribute starts with the text E_DOS_TITEL. The ends with comparison operator is $=, and contains is *=. The example provided above should work as long as it's the only input element ...


2

Create function AdminLogin Create into each test class method SetUp (doc) Call admin_login by SetUp Looks like: protected function setUp() { AdminLogin(); } This method calls before each test into test class Good luck!


2

To add to gomesr's answer, you might find yourself needing to wait for other elements during your tests. One way to easily have reusable code for this is to use a closure (also known as an anonymous function or a lambda function) to create a spinner function that you can call whenever you're waiting for an element to load. The spinner function would look ...


2

You didn't say whether you were using Ant or something else. I will assume you are more interested in the "positive and negative" part of the question than how to invoke the JUnit test runner from your build tool. You can register a TestWatcher to monitor what happens during a test run. The JUnit test runner will invoke methods on the TestWatcher when ...


2

I know you can do this using Appium and launching the Chrome browser app. The set up is quite a bit more then selenium AndroidDriver. I have gotten pretty close to doing it. If your developing on windows, one hurdle is the framework seems to be written and maintained by all Mac users so the windows support and documentation is quite scarce. Also you will ...


2

I don't see why this couldn't be done if you have a code driven Selenium test suite. You would need to implement a method run on test failure that adds a bug to Bugzilla using their HTTP REST API. For the first step, if you are using Java, see this answer on taking a screenshot when selenium fails and the referenced blog post. You need to similarily ...


2

You can use the following code also to handle popup. String mainwindow = driver.getWindowHandle(); for (String popup : driver.getWindowHandles()){ driver.switchTo().window(popup); } // Your code on poppup window driver.switchTo().window(mainwindow); //Switching to main/parent window Hope this will help :)


2

I've found in the past that using a BDD framework like SpecFlow helped me with this. You can start off writing the tests, and slowly start writing the code for it each of the tests as your able to. SpecFlow is great for code re-use, although, it can take some getting used to. An example of this is every time you use "And log in to the application", the ...


1

Inspired by JUnit's experimental ParallelComputer runner I've built my own ParallelSuite and ParallelParameterized runners. Using these runners one can easily parallelize test suites and parameterized tests. ParallelSuite.java public class ParallelSuite extends Suite { public ParallelSuite(Class<?> klass, RunnerBuilder builder) throws ...



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