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

in TestNG how is the dependonfunction works for the inheritance

Suppose I defined two class BaseClass and DerivedClass below. The waitPeriod for base is 1 minutes, and the waitPeriod for derived is 5 minutes. class BaseClass { protected String getDatasetType() { return "BaseClass"; } …
yi wang
  • 13
  • 3
0
votes
1 answer

Previous class runs over again when we run testcases using testng

I have 2 class which I'm running through TestNG, class A has 2 methods and class B has one method but when I run the suite of class A and B through TestNG, It runs like, class A method 1 & 2 will run and with class B it's method runs and method of…
0
votes
1 answer

How to select 2 or more values from the drop down with Data Driven Approach - this is working now

This is my code: Excel util: public static Object [][] getTestData(String sheetName) { try { FileInputStream ip = new FileInputStream(TESTDATA_SHEET_PATH); try { book = WorkbookFactory.create(ip); …
0
votes
1 answer

@Optional in TestNG Parameter is overriding the values that I'm passing in XML

When I try to use multiple parameters using @Parameter, @Optional needs to pass the value only when I'm not providing the value for the parameter in testng XML. But in the below scenario, no matter what I pass in the XML for the "Optional" parameter…
0
votes
1 answer

How can I make this testNG test dynamic but remain parallel

public class FactoryTest { @Test @Parameters("Row") public void run1(int row) throws MalformedURLException{ new Controller(row); } }
0
votes
1 answer

How to make dynamic parallel tests in testNG

I am running parallel tests using testNG and inside of my testNg java file I have this code: public class OfficialTest { @Test public void run1() throws MalformedURLException{ new Controller(1); } …
mastercool
  • 463
  • 12
  • 35
0
votes
1 answer

Setting annotation for a @test method at run time using testngListners

I am working on allure reports using testng and have a very basic method like below. @Test @DisplayName("Hello this is a description for allure report") public void method1(){ System.out.println("Hi i am from method1"); } here in the above code,…
Learnfever
  • 21
  • 1
  • 5
0
votes
1 answer

Shouldn't @Test with "alwaysRun=true" run irrespective of methods or groups it belongs to"?

I've a simple class with 3 methods. I'm running the test using the testng.xml file written below. When I run the test I get Test 1, Test 2 in results. I was expecting to see Test 3 as well because Test3 is set to "alwaysRun=true" which should…
0
votes
1 answer

After handling Alert and waits,The page is not loading and cannot locate elements. (in Selenium)

After handling Alert and waits(popup at runtime,)The page is not loading which is why cannot locate elements. (in Selenium)getting no such element: Unable to locate element: ''''public class ApplicantLoginPageTest extends TestBase{ @Test …
0
votes
0 answers

How to manually edit testng.xml in eclipse Version: 2020-06 (4.16.0)

Can anybody suggest me how to manually edit TESTNg.xml file in Eclipse Now with new version it has no option for editing.Also i created my Testng.xml my converting my code to TestNG,Then testng.xml file got created. My classes in testng.xml are as…
0
votes
1 answer

TestNG annotation BeforeMethod and Aftermethod Issue in Selenium JAVA

I have written the following test using the testNG annotations: public class Create { WebDriver driver; @BeforeClass public void testsetup() { WebDriverManager.chromedriver().setup(); driver = new…
0
votes
1 answer

TestNG- Results are overwritten after every run

I am very new to java & TestNG . I did a java-selenium POC concept where the test script executes well but the results are overwritten after every run. I managed to add a timestamp for the screenshot for failed but could not do that to emailable…
0
votes
1 answer

IAnnotation transform method is not disabling the test in testng

Here my intention is , Based on the before method condition the @Test method needs to enabled or disabled But in the below code even though I am passing the test case name its not getting skipped ? Can anyone suggest me solution? I need the…
0
votes
4 answers

"No tests found. Nothing was run" error in selenium automation using TestNG

Given below is the code that I coded using selenium in eclipse. import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; import org.openqa.selenium.By; import…
0
votes
1 answer

How to make testNG run class by class with orders of tests - testng

I have a question regarding testNG. I have five classes of tests (class a,class b,class c , class d,class e) and in each class 3 tests (test1 test2 test3) The problem is that I have @Test(groups = {"smokeTest"}, enabled = true, priority = 1) in all…