As a best practice, tests will reside in the same project as the code that they test. Also, ideally, they should be written in the same programming language as the code itself. If the code is Java, it’s useless to come up with some different language or so called framework to test it. Developers write Junit or TestNG tests, why shouldn’t QA’s do the same? The language itself offers most of what you need for testing, and where it doesn’t, there are plenty of libraries you can use to help out, that can easily be imported into the project. There is vast knowledge around, so if you are in doubt there are numerous people to turn to for advice. Also, it’s better if the developer and QA speak the same language. Developers can give you input regarding best practices for writing code, so that your tests can be easily readable by any member of the project team, maintainable, effective.
Having said that, if you are the one who will create the project, you can do it quite easily, using Maven.

On your computer, open the command line. Navigate to the location where you want to create a new project and type the following command:

mvn archetype:generate

You will get a huge list, suggesting what types of projects you can create. A suggestion is made for you at the command line cursor (near the text ‘Choose a number or apply filter’). Type in the suggested number. This will generate a ‘maven-archetype-quickstart’ type of project. This will generate a very basic project for you to work with.
Next, you will be asked for this type of project’s version. Type in the suggested number.
Next you need to enter the groupID. This information will uniquely identify your project, and it must follow the naming conventions that Java developers adhere to: . For the purpose of this tutorial, i will create the following’.

For the artifactID, enter the name for your project. For this tutorial, i will create the following artifactID: ‘testproject’.

For the version property, enter the following information: ‘1.0-SNAPSHOT’.

For package just enter ‘jar’.

After this, you will get a confirmation screen. Type ‘Y’ to confirm the information you just typed in. You will get a ‘Build Success’ screen, which means the project compiled and the project’s files are properly structured inside folders and packages.

The next step is to import the generated project into your IDE. It needs to be imported as a Maven project. The information on how to import the Maven project can be found here: for Intellij – and for Eclipse – . By examining the project structure, you will have the following folders (screenshot is generated by Intellij, so the .idea folder and the .iml file are specific to this IDE).

Notice you now have the two folder structures: src/main/java and src/test/java. The developer’s code will be places within the ‘main’ folder, the tests will be placed within the ‘test’ folder.
After successfully importing the project into the IDE, open the pom.xml file.  Edit the file, so that you are only left with the following information in the file:

<project xmlns="" xmlns:xsi=""



Also, delete any file or folder that might appear in the following location within your project: src/main/java and src/test/java. These are default files generated by Maven for the specific project type you chose at the ‘generate archetype’ step (because you chose ‘jar’ for the ‘package’ parameter when you generated the project, you will have a ‘jar’ folder inside the two folders mentioned above, each folder containing a class, that you won’t need in your tests).

Now, from the command line, browse to your project’s location. Type the following command:

 mvn clean install

This command should now return a ‘Build Success’ message. This means the project has successfully compiled and it is ready to be setup for your testing needs.
The next step is to import the testing dependencies, which you will learn how to do here: For more information on what the pom.xml file is, you can read this documentation from Maven:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.