Can anyone help me start using testNG in IntelliJ?

2,946 views
Skip to first unread message

Sorin

unread,
Jan 23, 2015, 2:48:27 AM1/23/15
to testng...@googlegroups.com
Hi Everyone!

I am very new to testNG, IntelliJ and Java development, so please be patient with me :)

My goal is to create performance tests using Selenium WebDriver, IntelliJ IDEA, Java and testNG.

What I have so far is a Java class in IntelliJ that is working fine (for one user though):
- It is a very simple one, until I get to know enough to scale it to a full performance test

Since I have no idea how to setup testNG, including the annotations and everything else about it, I am wondering... is there any documentation about starting with testNG & IntelliJ from zero?

Thank you in advance!

Regards!

Krishnan Mahadevan

unread,
Jan 23, 2015, 12:09:07 PM1/23/15
to testng...@googlegroups.com

The documentation on jet brains website should get you started with intellij and testng.

To learn testng I will recommend that you get a copy of  http://testng.org/doc/book.html

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Russel Winder

unread,
Jan 28, 2015, 5:43:52 AM1/28/15
to testng...@googlegroups.com
On Thu, 2015-01-22 at 23:48 -0800, Sorin wrote:
> Hi Everyone!
>
> I am very new to testNG, IntelliJ and Java development, so please be
> patient with me :)

I generally avoid setting up projects directly with the IDE, I much
prefer a separate file specifying dependencies etc. I used to be a fan
of the Gradle eclipse and idea plugins, getting Gradle to set up the
Eclipse and IntelliJ IDEA plugins. Now though Eclipse Gradle plugin
works well, and the IntelliJ IDEA Gradle plugin is seeming excellent.

So for me, Step 1 is set up a Gradle build for the project, the Step 2
is import the Gradle build into IntelliJ IDEA thereby making a project.

> My goal is to create performance tests using Selenium WebDriver, IntelliJ
> IDEA, Java and testNG.
>
> What I have so far is a Java class in IntelliJ that is working fine (for
> one user though):
> - It is a very simple one, until I get to know enough to scale it to a full
> performance test
>
> Since I have no idea how to setup testNG, including the annotations and
> everything else about it, I am wondering... is there any documentation
> about starting with testNG & IntelliJ from zero?

Set up a Gradle build (see http://www.gradle.org), one I have does thing
such as:

apply plugin: 'java'

sourceCompatibility = 8

repositories {
jcenter()
mavenCentral()
}

dependencies {
testCompile 'org.testng:testng:6.8.17'
// It seems that TestNG is failing to transitively demand this
dependency :-((
testCompile 'com.google.inject:guice:2.0'
}

test {
useTestNG()
}

clean.doLast {
delete 'test-output'
}

defaultTasks 'test'

Ensure you have the IntelliJ Gradle plugin installed, import the Gradle
project, have everything Just Work™



--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel...@ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc

Krishnan Mahadevan

unread,
Jan 28, 2015, 5:46:12 AM1/28/15
to testng...@googlegroups.com
This can be referred to as well : http://testng.org/doc/maven.html

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Russel Winder

unread,
Jan 28, 2015, 6:29:23 AM1/28/15
to testng...@googlegroups.com
On Wed, 2015-01-28 at 16:16 +0530, Krishnan Mahadevan wrote:
> This can be referred to as well : http://testng.org/doc/maven.html

I had assumed everyone had stopped using Maven and moved to Gradle. But
I guess Maven is like Ant, some people will keep on using it ;-)
signature.asc

Krishnan Mahadevan

unread,
Jan 28, 2015, 6:32:34 AM1/28/15
to testng...@googlegroups.com
I haven't heard of many people use Gradle in this forum.. but I have seen a lot of people use Maven... So I guess yea, many of us will still use Maven, while the new and adventurous ones explore the new tools :)

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Cédric Beust ♔

unread,
Jan 28, 2015, 12:31:21 PM1/28/15
to testng...@googlegroups.com

On Wed, Jan 28, 2015 at 2:43 AM, Russel Winder <rus...@winder.org.uk> wrote:
          // It seems that TestNG is failing to transitively demand this
        dependency :-((
          testCompile 'com.google.inject:guice:2.0'

Well, this dependency is marked as "provided" in TestNG's pom.xml, so it seems like this is working as intended, right?


-- 
Cédric

Russel Winder

unread,
Jan 30, 2015, 8:30:49 AM1/30/15
to testng...@googlegroups.com
On Wed, 2015-01-28 at 09:30 -0800, Cédric Beust ♔ wrote:
[…]
> Well, this dependency is marked as "provided" in TestNG's pom.xml, so it
> seems like this is working as intended, right?
[…]

I clearly was not looking at this clearly enough. Yes if the dependency
is "provided" then it must be provided and not left for transitive
collection. I'll change my comment, and possibly the Gradle
dependencies.

I got a bit worked up because I originally depended on Guice 3 and
nothing compiled.

It is all working tickety boo now.
signature.asc

Cédric Beust ♔

unread,
Jan 30, 2015, 12:15:11 PM1/30/15
to testng...@googlegroups.com
That's two storms in a row :)


-- 
Cédric


Reply all
Reply to author
Forward
0 new messages