Problem: My classes are Hooks for setup and test. I try to click on cookie pop-up, using WebdriverWait, but don’t work. I have no idea why. I am a beginner with selenium and automation testing and I am writing a selenium script using java, TestNG, and maven. When I write everything in one class, all works fine, but I want
Tag: testng
what is execution order of TestNG?
Parent class has @BeforeClass. Child class has @BeforeClass and @Test. What is an execution order? What is execution order if @BeforeClass methods’ names in both classes are the same? Answer First @BeforeClass in parent class is executed, then @BeforeClass in child class. If @BeforeClass name is the same in parent and child class, then you are just overriding the method
Sharing an Object between two Test classes in either JUnit or TestNG
Forgive the elementary question, I am learning Java still so need some advice on best practice here. I have a valid scenario where I wish to share the same object between two distinct Test classes using JUnit or TestNG. I understand that tests/test classes should not usually share state but this is a long-running journey. I understand the JVM executes
I’m trying to mock a list of strings but it’s not working. I’m not able to figure out the problem
This is the class and the corresponding test I have written for it. Can someone please help me understand why System.out.println(a.size()) prints 0 , when it should print 1000? WorkingwithLists.java …
How to print exceptions on console? I am using TestNG and Maven
I want to see the exceptions on console. I am using TestNG with Maven as a build tool. I have defined my testng.xml in the Maven surefire plugin. Answer https://www.javadoc.io/doc/org.testng/testng/latest/org/testng/reporters/VerboseReporter.html you should use above reporter , but the constructor expects a string so you cannot initialize it using testng.xml ( if any one knows how to pass string argument to
How do I stop selenium automation if 20% or 1st 20 test cases test methods are failed?
I have 100 test cases, if 20% or first 20 test cases all fail how can I stop the execution ? Already have testng ITestResult where should I break the build? Where can I break this suite if Result, “FAIL is over 20 ? DO i require to create new class or can I add in same below? Answer You
Jersey test framework: Test Container is null
I have the following test class that tests a simple “/helloWorld” endpoint that is implemented in jax-rs. I am running this as an EAR file in a JBOSS EAP Server locally. When I run the test I get the following: Answer JerseyTest is not compatible with JUnit 5 at the moment. https://github.com/jersey/jersey/issues/3662 From their workaround, add to your class, and
Can’t run testng.xml in Cucumber-Maven(TestNG)
In eclipse IDE, I have created a basic cucumber framework by using Maven project. I have added all the dependencies required in pom.xml.For TestNG plugin added below dependencies. But ‘TestNG Suite’ option was not coming in preferences,so installed TestNG through Help->Install New Software. Framework is having feature file(scenario is described),stepdefinitions(code/logic given) and runner class(To map feature with stepdefinitions file and
Maven doesn’t run my testng.xml
When i’m running through testng.xml (right click on testng.xml, then run as TestNG) it works fine – 2 of the tests i have there are running, but when i’m running it from Maven (mvn test) it just perform build and doesn’t run the tests. BTW – i noticed that if i have classes with the word Test in them they
NoClassDefFoundError: org/testng/TestNG
This error NoClassDefFoundError: org/testng/TestNG appears when I’m trying to run my test from Testng.xml file using IntelliJ IDEA. Running my test one by one works perfectly as well as running whole gradle project which points to testng.xml, like grade core-test:test ( On my project I’m using Appium + IntelliJ + TestNG ) But when I’m running testng.xml using IntelliJ I’m