New answers tagged

1

Using priority to drive order of execution is perfectly fine, but question is why do you want to execute test cases in certain order? As a general rule test case should be atomic and should not be dependent on another test cases. In such case do you worry about order of execution. I rather don't pay much attention to order of execution unless its an explicit ...


0

If the element not being found is an expected failure in the event of a bug. One thing you can do is throw an assertion error which imitates the natural way to fail a test. try { driver.findElment(by.name("textbox")).click(); } catch(ElementNotFoundException e) { throw new AssertionError("A clear description of the failure", e); } Passing in your ...


0

I would assume that to run test cases in parallel, you need to have multiple instances of the same test - which is not possible if classes are static. In Agile development, when deciding which approach to use to solve a problem, good idea is try spike solution - in your example it would be before committing yourself to architecture, try one simple test ...


1

As I understand you want execution to stop if error occurs, in that case you don't want to inclose your code in try and catch block. Remove try and catch block and add @AfterMethod in your testng class. Once your program errors out it would move move to AfterMethod block or after successful completion of your test. @AfterMethod public void cleanup(){ ...


0

Your scenario is really long and include many things. Let break down it to smaller parts, example Search product Go to site Search with keyword Verify search result Compare product Go to product detail page Click "Compare this Product" button Verify something comparison page: price, quantity, ... it depends your purpose Checkout Go to product ...


0

Cucumber is not really driven by JUnit. JUnit Runner is an easy way to integrate running cucumber into an existing testing infrastructure (like mvn verify). That one single empty JUnit Runner class should not give you much pain against TestNG. The only thing important for you is to plug it into a proper build lifecycle phase, we often use it on ...


0

In a webpage, there is a "Top" window, which can be considered as a default frame (not conceptually) and there can be zero or more iframes. While executing the automation test script, the driver always points to the default frame which is "Top". If you want the driver to find the element which is inside an iframe, you need to first locate the iframe and ...


3

Major difference in TestNG and JUnit test frameworks is their scope. Junit is a unit testing framework while TestNG addresses testing at a higher level. and my recommendation is TestNG(Next Generation) Framework. Find the some references to get details about both of them- http://www.slideshare.net/ssuser220b38/junit-and-testng ...


6

JUnit 4 and TestNG are both very popular unit test framework in Java. However, TestNG's goal is much wider, which includes not only unit testing, but also support of integration and acceptance testing, etc. Which one is better or more suitable depends on use contexts and requirements. Annotations: In JUnit, the @BeforeClass and @AfterClass methods have to ...


0

Cucumber-jvm is object oriented while TestNG is class oriented. The two don't mesh well. That being said, take a look at the following: automatictester java-calculator-testng testng The best option appears to be one TestNG test runner per feature file.


1

Check this answer. It explains that you need the Safari Driver Jar in the build. It can be added as a Maven Repository or manually added to the build path.


0

If the id is changing dynamically for a particular xpath then we can use the below xpath functions: contains : xpath Syntax: //html tag[contains(text()/@attribute, 'Expected Value')] Following-Siblings: Xpath Syntax : //html tag/following-siblings::html tag e.g : //img[@src = 'image2.jpg']/following-siblings::input[@type = 'button'] Preceding-Siblings : ...


4

At this situation We have lots of options- Option 1 : Look for any other attribute which Is not changing every time In that div node like name, class etc. So If this div node has class attribute then we can write xpath as bellow. //div[@class='post-body entry-content']/div[1]/form[1]/input[1] Option 2 : We can use absolute xpath(full xpath) where you ...


2

Use contains() or starts-with() function in xpah : Solution : With contains : //div[contains(@id,'post-body')]/div[1]/form[1]/input[1] With starts-with : //div[starts-with(@id,'post-body')]/div[1]/form[1]/input[1] Let me know If any query.



Top 50 recent answers are included