Questions tagged [testng-annotation-test]

Test Annotations: The @Test annotation marks a class or a method as part of the test.

@Test Annotation: The @Test annotation marks a class or a method as part of the test.

Documentation: TestNG

75 questions
0
votes
1 answer

IAnnotationTransformer Method Description in TestNG

When implementing IAnnotationTransfer interface in TestNG, there is a parameter called annotation which is the annotation that would get read from the test class. Now, there are few methods that are straightforward whereas various methods of…
Vijay Gupta
  • 21
  • 1
  • 7
0
votes
1 answer

TestNG parameters declare variable issue in value

I having issue in passing this value for my testing.xml mainly because the elements contain "" in between the lines, here's my code below pasted in xml and my parameter sentence declared in xml file //*[@id=\"aaa_registered_check-false\"] Any…
0
votes
0 answers

The output of TestNG java class on inherited class is confusing

I have two classes which are specified below package otherFeatures; import org.testng.annotations.Test; public class DependsOnInheritedTestMethodExample extends ParentClassExample{ @Test(dependsOnMethods = "myTestE") public void myTestA()…
puchu
  • 69
  • 1
  • 9
0
votes
1 answer

TestNG @Test methods do not executes in specified order in xml, when we add dependencies in class

If I have class and xml as follows : class Test { @Test public void method1() {} @Test (dependsOn = "method1") public void method2() {} @Test (dependsOn = "method2") public void method3() {} @Test (dependsOn = "method1") …
omkar
  • 1
  • 1
  • 1
0
votes
1 answer

Extending from base class with TestNG with java

I am writing some test classes and extending from base test class. But the problem is even though I lock the isInited variable it runs once for each class. It should be run once and initialize it after that it should not be called again but it calls…
Lisa
  • 129
  • 1
  • 1
  • 8
0
votes
1 answer

Syntax error, insert "EnumBody" to complete ClassBodyDeclarations error while importing @Test annotation of TestNG within Eclipse

I am learning Selenium.. I have successfully installed Testng on my machine but unable to import @Test from Testng while writing the script.below is the error message. @Test Error: Syntax error, insert "EnumBody" to complete…
0
votes
1 answer

TestNg Parameters

I am new to SELENIUM TESTNG, i need to create a method contains two parameters one i am sending the parameter form testng xml and the other i am passing from where the method is called. I want to have a reusable code to check which DB connection i…
0
votes
1 answer

Will inherited @BeforeTest Method run multiple times?

When using TestNG, If multiple test classes inherit a class containing a @BeforeTest method, will it run only once or everytime when each of the classes are called in the test case? When I run the below code, the text "BEFORE TEST EXECUTED" is…
anandhu
  • 686
  • 2
  • 13
  • 40
0
votes
2 answers

How to remove any test from TestNG results or ITestContext

Background: I am using TestNG DataProvider Requirement: Need to eliminate 1 test from the TestNG report after execution is finished. My Solution: Suppose, I need to remove the 'XYZ' test case from the report. String testName = "XYZ"; private void…
0
votes
1 answer

@Test is not executing - If I add TestNG Listener in test xml file, my @Test methods are not executing

I'm using TestNG and for reporting using extent report. I'm trying to add TestNG Listeners to perform some operation on Success and on Failure. I have created a Test Listener class and mentioned listener in suite file.Issue is Test is not executing…
0
votes
1 answer

Is it possible to have only 1 implementation of IAnnotationTransformer in a project

Can we have more than 1 implementation of IAnnotationTransformer in a project that is using TestNG? I'm using TestNg version 7.0.0.
Sarath
  • 1,438
  • 4
  • 24
  • 40
-1
votes
1 answer

I am getting this error while running the testng file in eclipse

Java Code : package java_package; import org.testng.annotations.Test; public class Testng1 { @Test public void log() { System.out.println("Hello"); } } getting this error: [RemoteTestNG] detected TestNG version 7.8.0 Exception in thread "main"…
-1
votes
3 answers

Is there a way to get the class variables into the testNG before method of super class

I have @test methods in a class1 and @before method in super class. I wanted to get the class variable declared in class1 to be accessed in @before method.
-1
votes
1 answer

Run Test Method miltiple times with different testdata using just anotations

I would like to run the test method multiple times and during each of test runs, I want initialise method to be run with different parameters for the RestApiCall.sendRequest() method say a,b,c and d. Also I want the test method to print the testname…
cfc123
  • 11
  • 1
-2
votes
1 answer

How to demonstrate a real time example of using BeforeTest, AfterTest, BeforeSuite, AfterSuite, BeforeClass, AfterClass annotations in TestNG

How to demonstrate real time example of using BeforeTest, AfterTest, BeforeSuite, AfterSuite, BeforeClass, AfterClass, BeforeMethod, AfterMethod annotations in TestNG Selenium.
1 2 3 4
5