Questions tagged [java]

Questions about testing applications written in Java or test automation written in Java, a popular programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

java logo

Adapted from the SO [Java] tag.

Initial help

Before asking a question, use the search box in the upper right corner to see if it has been asked before by others (we have many duplicates), and please read Writing the perfect question to learn how to get Jon Skeet to answer your question.


Background

Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems and released in 1995. Java is currently owned by Oracle, which purchased Sun on April 20, 2009.

Very few computers can run Java programs directly. Therefore the Java environment is normally made available by installing a suitable software component. For Windows computers, this is usually done by downloading the free Java Runtime Environment (JRE) from Oracle which allows the system to run Java programs. The easiest way to do this is from java.com.

Developers frequently need additional tools which are available in the free Java Development Kit (JDK) alternative to the JRE, which for Windows must be downloaded from Oracle and installed manually.

Note: Other vendors exist but usually have license fees. For Linux and other platforms consult the operating system documentation.

More information:

Hello World

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}

Java source code is compiled to an intermediate form (bytecode instructions for the Java Virtual Machine) that can be executed with the java command.

Beginners' resources

  • The Java Tutorials - Starts from scratch on Windows/Linux/Mac and covers most of the standard library.
  • Coding Bat (Java)- After learning some basics, refine and hone your Java skills with Coding Bat.

Day to day resources

Advanced resources

Books

Frequently Asked Questions

  • Maybe when we're out of private beta we'll actually have FAQ to put here? :-)
1464 questions
8
votes
2 answers

TestNG Mark a Test as Failed if a Particular Path is Used

Is there a way to mark a test as failed in the TestNG framework if a certain path is followed? I know I can use system.exit(1); or something similar to mark an abnormal termination but it doesn't seem to actually mark the test as failed.
Brett K
  • 315
  • 1
  • 3
  • 6
5
votes
2 answers

Isolating defect in distributed event-driven system

Our system takes an object from external system every time the object gets changed (change event), processes it and put it back processed into this external system. So, end-to-end testing is about making a change to an object on one end and watching…
dzieciou
  • 10,512
  • 9
  • 47
  • 100
4
votes
1 answer

System / Integration testing for 'daemonized' components in Java

We have a moderately large collection of Java components (some using some JNI). Each launches as a daemon (or Windows service) using the Tanuki package. Some publish SOAP or REST endpoints, others take messages from JMS. Some talk to each…
bmargulies
  • 141
  • 4
3
votes
1 answer

How to improve slowness of my automation code?

I am doing automation. But my code working takes more time. I am taking index value from deDupStringList array. for click on the gui application. I read the data from back end. This is my entire number…
user32519
3
votes
2 answers

How to use multi dimensional array in java instead of using array list?

I wan to use multi dimensional array in java. instead of using arrayList. I am trying to rework on my code. I automate my app to select a game, but need to store in every row of data in string array....so i can loop through each row by row to check…
user32519
3
votes
2 answers

Fetch data from database and put into arrayList

I am automating my gui app. I am fetching the data from database here data contains 6 player and their position..and now I need to store all the data into arraylist... I need to store all the data and put into arraylist.. java.sql.Statement stm1…
user32519
3
votes
2 answers

How to improve speediness of automated checking

I am working on Windows automation using the win app driver tool. I am using java language. My app is commentary related software. It is very data-heavy, so I am using a data driven framework. I am keeping all the data in an excel sheet and read…
user32519
3
votes
1 answer

Looking for a valuable Mockito tutorial

I'm looking for a good Mockito tutorial. I found some things, but either they are incomplete (which means: if you need something a bit more complicated than the basics, forget it), or they are badly explained. Do you know some tutorials well written…
Alexis Dufrenoy
  • 488
  • 5
  • 13
2
votes
5 answers

Validating HTML code

I am testing a class that takes 1 string and generates an HTML page around that string. So I pass it the string Math and it returns to me a whole HTML page as a string containing that Word and with matching a header

and a form.…
Mike John
  • 135
  • 2
  • 6
2
votes
1 answer

How to debug heap thrashing problem

My application is causing heap thrashing. I have the heap dump but I don't know how and where should I start to look for problems? This is a 6 GB dump. Please recommend some suitable heap analysis software?
Asad Iqbal
  • 133
  • 4
2
votes
1 answer

Webdriver : How to upload a file using relative path in java?

Need to upload an image using the relative path, which I would like to run on both IDE and command line. Here is the code which runs with the absolute path, File classpathRoot = new File(System.getProperty("user.dir")); File…
jass
  • 333
  • 3
  • 5
  • 9
2
votes
1 answer

Issue in executing testcases in TestNG(java)

How to run other tests in TestNG after one test is failed using Java For example: @Test(priority=1) public void Online1(){ //code } @Test(priority=2) public void Online2(){ //code } In the above code, if priority 1 fails then…
surya
  • 45
  • 3
2
votes
2 answers

How difficult is selenium and test-automation in general?

How difficult is it to start writing test-scripts for someone who has been coding in Java? I've been hearing a lot about test-automation, selenium, test-script and so on but I cant get my hands on code-examples or something that can give me an…
Kharbora
  • 551
  • 1
  • 7
  • 18
1
vote
1 answer

Excel Reader - How to read numeric and string values from Excel file?

static Workbook book; static Sheet sheet; public static Object[][] getTestData(String sheetName) { FileInputStream file = null; try { file = new FileInputStream(TESTDATA_SHEET_PATH); } catch (FileNotFoundException e) { …
1
vote
1 answer

Writing requirement for specific Java (JRE) version

The system in which our application must run has a specific version of Java Runtime Environment (JRE) installed and it may not be changed. Therefore I have written a system requirement for my team, which we shall test later (before delivering the…
Stuart
  • 51
  • 4
1
2 3