Tag Info

Hot answers tagged

9

I suspect this is not a TestNG issue. I would start by trying to produce a minimal set of tests that, when run together, cause failures. After that, I would explore these possibilities: Inter-test interaction changes test-application interaction: It is possible that interaction between your tests changes how your test interactions with your application. ...


5

I have used Selenium and TestNG in the past to manage a lot of my automation and as Siva mentioned you do have the basics down. While TestNG is one of the most common Frameworks out there, it is not the only one, and you can use whatever one works for you. So long as you can import the Selenium drivers you can use any framework in which you are familiar, ...


4

You mean to say in one class multiple methods you want to run, then use below code and try. @BeforeTest public static void beforeMethod() { driver= new FirefoxDriver(); } @Test public void main1() { driver.get("http://indianrail.gov.in/pnr_Enq.html"); driver.findElement(By.id("element")).sendKeys("1234567890"); String ...


3

What type of machine are you running it on? Most likely it has nothing to do with TestNG having any type of thread limits (I couldn't find anything saying there were in fact limits) but rather your local box. Thread count limits on Windows or Linux are determined by the stack space. Explanations can be found here and here. On Windows the default stack size ...


2

I don't quite get why you would like to share browser session. UI test methods should be run in the own independent browser. In case you insist, you could use @BeforeClass of TestNG and have driver set up done in @BeforeClass method. Now both of your methods should be either in this class or class with extends the set up class. Confused? This might help - ...


2

Hello since you are getting the results in the List, you can export them to a file for use in future, or can use them further for comparison or whatever you need since the data is already stored in the List variable. You can see in this sample code here - http://milinpatel17.wordpress.com/2014/07/02/web-page-link-test-using-selenium-webdriver/ that I have ...


2

Place this in your test or suite tag: preserve-order="false" If this is not in there, parallel classes will not work.


1

I can see several problems in your code. Paramaterized @BeforeSuite method with no data provider. Your @BeforeSuite method (main()) takes a parameter (args), but you have not told TestNG how to provide a value for that. That's what that exception message means. Calling test methods. When you run under TestNG, your @BeforeSuite method calls your test ...


1

I found this really simple code to write output to file. You can find it here - http://www.mkyong.com/java/how-to-write-to-file-in-java-bufferedwriter-example/ You can customize the code to fit your need and write the list values to file by placing the bw.write() part withing a loop.


1

The short answer is that yes, you can do this. I don't have the code that will do it to hand, but you will find the basic information at http://msdn.microsoft.com/en-us/library/hh694602.aspx The Microsoft preferred method is to store the test data in some form of external data source (so that if the data needs to change you don't need to recompile) - the ...


1

You are comparing values, so better you store each values in the String and compare both the String values.


1

Like Josa Pita says, that is nothing for testing frameworks itself. The developers could write a script to save the current version of the DB. The process should look like that: Save current version of DB/any kind of data storage. Start test run. After test run finished restore the saved version of the DB/any kind of data storage. But I think it is ...


1

When you run your TCs through TestNG, a test-output folder is created, which contains a file with name emailable-report.html, so basically you need to send that file as an attachment to the stakeholders. Here I've considered the fact that your localhost is configured to send emails. Please find below the code that you can use. import java.util.*; import ...


1

Your have four threads, each running test in a separate browser instance, but reading whole file again and again. This is because each thread knows nothing about what test data other threads used. A solution to the problem is to move loading and distributing test data among threads outside the test so that something else passes test data D1 to thread T1, D2 ...


1

You seem to have picked up basics correctly. I can add my inputs Selenium is mainly for web test automation. Predominantly you will simulate user actions on the website. The code generated by IDE need to be modified to make it data driven / organizing test scenarios etc If you are going to write automation code (you need to manage input data handling, ...


1

Suggestion: Every test automation shall run in a dedicated environment, dev code/script/db changes shall always auto deploy to this environment, automated test shall only run here. With such design the team can easily design the automated test an test data as well. After each success test execution, restore the whole db.


1

Instead of simple System.out.println (last line in your example) try out the following: PrintStream out = new PrintStream(System.out, true, "UTF-8"); out.println("Currency Selected:" +select.getText());


1

Approach 1 Create a class, for example Hull. In the cass is a protected variable WebDriver driver. In the class is a method setup() with a @Before annotation. In the method you has a condition: Is WebDriver null, initialize; else do nothing. Classes with test cases extends from Hull. Classes with test cases can use the variable driver. Approach 2 ...


1

"And I have one another class which I need to run before that @BeforeClass method in 4 of the tests." To achieve: Just make all of the 4 class extend this "AnotherClass" and add @BeforeClass annotation in the constructor of this class. Hope this will help.



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