Hot answers tagged

5

Absolutely you need negative cases! In fact developers will likely have focused on the positive cases so the negative cases not present can add the most value! I recommend the following breakdown: Happy, positive tests. These test what happens when the user does everything right. They also used defaults as much as possible for input values Sad, negative ...


3

May be because there are many elements on the page with same xpath. check if you have more than one input type text element present on the screen. install plugin firepath on mozilla then paste your xpath over there it will highlight the elements ,if it highlights more than one element then you need to change the xpath


3

how many test cases can we write? Every time you ask that question, the answer will be "it depends". There is no industry standard or best practice that says, "You need 9 test cases" or "You need 1.4 times as many negative tests as positive tests." If your business contract includes conditions around test cases, you should probably honor your contract. ...


3

If I understand your question correctly you try to run the java file and not the compiled code. Try exporting your project as an executable .jar via eclipse and run this via "java -jar FileName.jar". Regarding the second part of your question though, I´ve got no idea what you were trying to say.


2

When you call driver.manage().deleteAllCookies() it deletes all cookies for the current domain. So if you're on bbc.co.uk page it will not be able to remove cookies for facebook.com domain. driver.manage().deleteCookieNamed(cookieName) can delete only a cookie for a current domain. It's stems from the the way Web browsers work, WebDriver cannot do more. ...


2

The expected condition elementToBeClickable checks two things: Visibility: it's not hidden per CSS rules (display: none)and has a height and width > 0 Clickable: the element may not have a disabled attribute It's perfectly possible that those conditions are met and you're still getting that specific exception. The most likely reason is some sort of pop-...


2

You can write test cases for both positive and negative scenarios. For example; phone number starts with a 0 phone number does Not contain "+" What most people tend to do is to devise their negative tests to be a positive scenario. This way, each test that passes is in a True state. This makes it far easier to interpret the results of your runs. The ...


2

Is there any other things I am missing from my list? You mentioned "Click on all "link" elements, making sure they are valid, e.g. there is no 404." Is that good enough? Shouldn't you check that the links actually go where they are intended to go? Are you checking for consistency on all the pages? Should they all have the same look & feel? Are you ...


2

If you're talking about bringing the browser's window within the OS to the foreground. Selenium cannot do that. You need to introduce a library that is able to automate actions on an OS level. Selenium is restricted by javascript's same origin policy. Looks like you're using Java, so you could take a look at awt.Robot. But be aware that any solution you ...


2

Agree with @Dale Emery. Use this code: public class WatchTV { WebDriver driver; WebDriverWait wait; int waitseconds = 60; public WatchTV(WebDriver driver){ this.driver = driver; wait = new WebDriverWait(driver, waitseconds); } By watchtvlink = By.linkText("Watch TV »"); public WebElement WatchTVLink() { ...


2

Yes. You can create an application to run your test scripts, when you create your test projects they are just libraries/dlls that you have created and they do work just like any other library/dll. add to references and you should be able to call specific tests and get their pass/fail value when they are finished.


1

What you could do, is try to use an existing profile in the browser, so that way it would actually save the cookies somewhere. Otherwise the webdriver starts up an anonymous profile every time that doesn't save the cookies, it just throws them away when the browser is disposed of. This is mentioned in this SO Answer to Selenium Webdriver not respecting ...


1

Your Setup() method runs (and initializes the driver) only in the Pg_WatchTV_Test class. Merely extending TestBase does not cause TestNG to run your setup method. It runs setup methods (annotated by @BeforeMethod and the like) only if the class has test methods. Your WatchTV class has no tests, so TestNG does not treat it as a test class. So the Setup() ...


1

When you return back to the page, page reloads and all elements become stale. For you it may look like same element (with same locator), but page is new object. So you need to fetch the elements again.


1

Since you have asked about tests approach in general - think about the non functional tests that are needed for your project: Desktop / mobile and different mobile compatibility - how will the site will look like in them? performance - how quickly the pages will load? and how much will take to submit the form you mentioned and continue? User experience - is ...


1

I haven't found a solution, rather an alternative. I have used Jenkins and used to BuildFLow plugin to create a Build Flow job. I use this job to call 3 other jobs to run parallel. The 3 other jobs are Maven jobs which are each pointing to their own test XML files which contains the tests classes I need to be run parallel. It greatly reduced the time of ...



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