maven


Set up Maven in Intellij with TestNG using POM to read .xml suite


Hey I have my project set up with Maven structure:
My pom file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.QASelenium</groupId>
<artifactId>MyTemp</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/resources/testing.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.31.0</version>
</dependency>
</dependencies>
</project>
My TestNGTest.java file is under src/main/resources:
import org.testng.Assert;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
public class TestNGTest{
#Test
#Parameters(value="number")
public void parameterIntTest(int number) {
System.out.println("Parameterized Number is : " + number);
}
}
When I compile it with TestNG using IntelliJ, WHy I always get this error:
org.testng.TestNGException:
Parameter 'number' is required by #Test on method parameterIntTest but has not been marked #Optional or defined
in C:\Users(My_Name).IdeaIC12\system\temp-testng-customsuite.xml
Can someone please point to me where I got it running wrong?
I am new to the maven, Thank you so much in advance.
I think all is fine, but if you are using xml suite, then you need to execute test from suite, not from class.
Run/Debug Configurations
Configuration -> Suite
Suite: /PATH/PROJECT/src/test/resources/testng.xml

Related Links

How to use property values in postinstall scripts during Maven build
Maven: No source to compile
jgitflow start-release fails for https url with OAuth token
is there any alternative for maven reactor plugin?
Cannot capture network packets in storm spout using jNetpcap
How to create 'resources' folder in Intellij?
Gradle tells me ' Must specify a repository for deployment'
Grails Unit Testing occurring on Wrong Phase of Maven Life Cycle
Maven variables set after running goals cannot be resolved in IDEA [duplicate]
Release project with SNAPSHOT test dependency
Continuous Delivery with Maven: Why not just use the build number a the artifact's version?
Maven settings not working for all projects
Groovy install HTTPBuilder now that Codehaus shutdown?
Spring mvc #RequestMapping on class level and method level 404 Status
maven .zip publish or upload error 302 to jfrog artifactory
Sharing common projects with Maven

Categories

HOME
wso2-am
gitlab
proxy
c#-4.0
fluentd
tizen
webstorm
wamp
onelogin
ios-charts
qore
paradox
correlation
decimal
workload-scheduler
code-review
google-search-api
kudan
trading
user-interaction
maquette
wtx
windowbuilder
bpel
socialengine
directx-10
devextreme
vxworks
dynamics-crm-2013
abstract-class
impersonation
angularjs-factory
gulp-sourcemaps
quadratic-programming
reactive-cocoa-5
btrace
wptoolkit
babel-core
google-datalayer
azure-application-gateway
youcompleteme
apache-fop
rails-routing
tizen-native-app
integrity
yii2-extension
tropo
orthogonal
static-ip-address
instant
infix-notation
rotativa
file-writing
nsfilemanager
connect-by
lttng
qcustomplot
asp.net5
ios8-today-widget
r-tree
prerequisites
cartesian-product
citrus-pay
libressl
browser-bugs
vstest.console.exe
angular-local-storage
sonarqube5.1.2
gui-test-framework
funcunit
bundles
hyprlinkr
industrial
seed
http-unit
jelly
delphi-6
chuck
word-processor
dsn
multipage
osql
vdsp
rfc1123
krl
pyinotify
mongomapper
datareader
remember-me
nhibernate.search
bespin
avatar
putchar
zune
.net-1.0

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App