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

bamboo plan generates rpm appended with snapshot and time stamp
Maven loads wrong version of dependency
No appenders could be found for logger (org.springframework.web.context.ContextLoader)
CircleCI circle.yml file - how to checkout differently with different branches
Maven: find usage of dependency by dependencies? [duplicate]
Maven structure with a single exposed artifact and internal dependencies
Automatically bumping up pom.xml with Maven release plugin
Use Maven to start programs
Sonatype Nexus endpoint for artifact's version number
Springboot with Maven running a react with webpack
Compile hadoop 2.7.2 have a error and I don't know why
Sonarqube dependencies page alternative?
Unable to insert into cloud Google SQL through endpoints
How to intercept maven plugin build log
Maven Release plugin: Doing the git push via https
How to inlclude JavaDoc for CPLEX API in a maven project?

Categories

HOME
log4j
openlayers
drivers
binary-tree
fingerprint
synchronization
adfs
medical
iggrid
kibana-4
progressive-web-apps
graphlab
http-status-code-504
lcd
cas
spark-jobserver
semantic-analysis
nhapi
wtx
large-file-upload
nat
preg-match
javascriptcore
galsim
google-qpx-express-api
lxd
repo
fusionpbx
overriding
overlap
file-format
xcode-extension
occlusion
code-search-engine
bootstrapper
unoconv
pdf-reactor
core-plot
bootstrap-dialog
checkboxlist
angular2-meteor
scorm
avconv
network-flow
jquery-validate
powercli
font-size
bind9
parallel-data-warehouse
instant
google-web-starter-kit
impresspages
fuzzy-search
simplewebrtc
lua-5.1
ready-api
qgraphicsview
whois
livequery
independentsoft
unity-networking
cannon.js
microbenchmark
ios9.1
nsight
gwidgets
angularjs-ng-click
socketexception
xojo
article
heisenbug
picturefill
cloud-connect
gnu-smalltalk
page-layout
shellexecute
padarn
hungarian-algorithm
delphi-6
jquery-knob
google-email-migration
assembly-loading
nsobject
appendto
calling-convention
cxxtest
google-friend-connect
dmx512
modelstate
meego
ctp4
multiple-languages

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App