how to run Selenium tests in Jenkins

112 views
Skip to first unread message

ama...@bufetedemarketing.com

unread,
Aug 14, 2017, 4:41:04 AM8/14/17
to Selenium Users
Hi guys!!

But now, I want to run each of hundreds tests that I've written in Selenium Webdriver with Eclipse.

I use Maven to create testng.xml (where I have my Maven projects to can execute a list of tests in the same execution). 
I use Eclipse to write Java to create tests in Selenium Webdriver.

I don't know if I'm right to ask it here, or I have to do it in another web page, sorry, I'm pretty new here.

Could anybody help me with this issue?

Thanks so much!!!!

ama...@bufetedemarketing.com

unread,
Aug 14, 2017, 4:43:45 AM8/14/17
to Selenium Users


El lunes, 14 de agosto de 2017, 10:41:04 (UTC+2), ama...@bufetedemarketing.com escribió:
Hi guys!!

But now, I want to run each of hundreds tests that I've written in Selenium Webdriver with Eclipse.

I use Maven to create testng.xml (where I have my Maven projects to can execute a list of tests in the same execution). 
I use Eclipse to write Java to create tests in Selenium Webdriver.
    I use github to import tests.

ama...@bufetedemarketing.com

unread,
Aug 14, 2017, 5:15:41 AM8/14/17
to Selenium Users
I show you my github project... I don't know how to access into the different folders to execute each testng.xml files. 


Thanks so much for your help!!!!! 

poobathy r

unread,
Aug 15, 2017, 1:29:57 AM8/15/17
to seleniu...@googlegroups.com
R u running through server or local machine

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ae45e3c6-ce98-4e49-b32d-683d89d7bdc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

DT

unread,
Aug 15, 2017, 8:59:07 AM8/15/17
to Selenium Users
In the absolute majority of cases Jenkins runs on so called "headless" server (which doesn't have a GUI) therefore unless you are using a "headless" browser like PhantomJS or HtmlUnit my expectation is that your tests will fail as Selenium Server won't be able to kick off a browser as browsers require a "display" to run at. 

See Headless Execution of Selenium Tests in Jenkins article to learn how to configure your Selenium tests to run on Jenkins in non-GUI headless mode. 

poobathy r

unread,
Aug 15, 2017, 9:48:48 AM8/15/17
to seleniu...@googlegroups.com
R u running in local machine or in slaves?

On 14 Aug 2017 2:11 pm, <ama...@bufetedemarketing.com> wrote:

--

ama...@bufetedemarketing.com

unread,
Aug 16, 2017, 3:02:52 AM8/16/17
to Selenium Users
Hi! I'm running through Jenkins Server. 
My tests are saved in Github and I want to get them from Github. I don't know what would be the path of my pom.xml ...

Any ideas?

Thanks so much!!!


El martes, 15 de agosto de 2017, 7:29:57 (UTC+2), poobathy escribió:
R u running through server or local machine
On 14 Aug 2017 2:11 pm, <ama...@bufetedemarketing.com> wrote:
Hi guys!!

But now, I want to run each of hundreds tests that I've written in Selenium Webdriver with Eclipse.

I use Maven to create testng.xml (where I have my Maven projects to can execute a list of tests in the same execution). 
I use Eclipse to write Java to create tests in Selenium Webdriver.

I don't know if I'm right to ask it here, or I have to do it in another web page, sorry, I'm pretty new here.

Could anybody help me with this issue?

Thanks so much!!!!

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted

ama...@bufetedemarketing.com

unread,
Aug 16, 2017, 5:04:49 AM8/16/17
to Selenium Users
HI!

I wrote this code in Configuration Source Code Project: Execute Shell:


cd "/cua/Researches/Filtro Afinidad Entidades - Anual y Trimestral - Ppales Entidades/" java -cp "/cua/Researches/Filtro Afinidad Entidades - Anual y Trimestral - Ppales Entidades-1.5.0.jar:/cua/Researches/Filtro Afinidad Entidades - Anual y Trimestral - Ppales Entidades/src/test/java/paquete/ " org.testng.TestNG testng.xml

And I get the following Output Console:

 + cd /cua/Researches/Filtro Afinidad Entidades - Anual y Trimestral - Ppales Entidades/ /tmp/hudson2620945203684152183.sh: 2: cd: can't cd to /cua/Researches/Filtro Afinidad Entidades - Anual y Trimestral - Ppales Entidades/ Build step 'Execute shell' marked build as failure Finished: FAILURE

Does anybody know why it returns an error?

Thanks so much!

poobathy r

unread,
Aug 16, 2017, 6:19:31 AM8/16/17
to seleniu...@googlegroups.com
Hi
Create a new job with all the parameters given below

 1.add the parameters
2.add the URL in string parameter
3.specify which slave to run
4.add the git repo
5.batch command if you are running through command prompt
6 or Ant script 
7 post build test report as XML
8 email notifications

Regards
Poobathy


To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/9708d857-9e24-4bd4-9409-85d4ce92e167%40googlegroups.com.

ama...@bufetedemarketing.com

unread,
Aug 16, 2017, 7:35:06 AM8/16/17
to Selenium Users
I did it but it doesn't solve my problem...
:(

ama...@bufetedemarketing.com

unread,
Aug 17, 2017, 3:09:47 AM8/17/17
to Selenium Users
I've tried with these lines in Execute Shell:

cd Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/
java -cp /cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/lib/*;/cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/bin org.testng.TestNG testng.xml


It returns the following in the Output Console:

+ cd Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/
+ java -cp /cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/lib/*
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)

 Arguments following the main class, -jar <jarfile>, -m or --module
 <module>/<mainclass> are passed as the arguments to main class.

 where options include:

    -d32	  Deprecated, will be removed in a future release
    -d64	  Deprecated, will be removed in a future release
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    --class-path <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -p <module path>
    --module-path <module path>...
                  A : separated list of directories, each directory
                  is a directory of modules.
    --upgrade-module-path <module path>...
                  A : separated list of directories, each directory
                  is a directory of modules that replace upgradeable
                  modules in the runtime image
    --add-modules <module name>[,<module name>...]
                  root modules to resolve in addition to the initial module.
                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
                  ALL-MODULE-PATH.
    --list-modules
                  list observable modules and exit
    -d <module name>
    --describe-module <module name>
                  describe a module and exit
    --dry-run     create VM and load main class but do not execute main method.
                  The --dry-run option may be useful for validating the
                  command-line options such as the module system configuration.
    --validate-modules
                  validate all modules and exit
                  The --validate-modules option may be useful for finding
                  conflicts and other errors with modules on the module path.
    -D<name>=<value>
                  set a system property
    -verbose:[class|module|gc|jni]
                  enable verbose output
    -version      print product version to the error stream and exit
    --version     print product version to the output stream and exit
    -showversion  print product version to the error stream and continue
    --show-version
                  print product version to the output stream and continue
    --show-module-resolution
                  show module resolution output during startup
    -? -h -help
                  print this help message to the error stream
    --help        print this help message to the output stream
    -X            print help on extra options to the error stream
    --help-extra  print help on extra options to the output stream
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:jdwp
                  see also -agentlib:jdwp=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
                  HiDPI scaled images are automatically supported and used
                  if available. The unscaled image filename, e.g. image.ext,
                  should always be passed as the argument to the -splash option.
                  The most appropriate scaled image provided will be picked up
                  automatically.
                  See the SplashScreen API documentation for more information
    @argument files
                  one or more argument files containing options
    -disable-@files
                  prevent further argument file expansion
To specify an argument for a long option, you can use --<name>=<value> or
--<name> <value>.

Build step 'Execute shell' marked build as failure
Finished: FAILURE


So... it doesn't do anything... why??
Thanks so much...

ama...@bufetedemarketing.com

unread,
Aug 17, 2017, 3:39:37 AM8/17/17
to Selenium Users
I've executed the following in Jenkins:

cd Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/
java -cp 
/cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/lib/testng-6.11.jar:/cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/bin org.testng.TestNG testng.xml

It returns:

+ cd Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/
+ java -cp /cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/lib/testng-6.11.jar:/cua/Researches/Filtro_Afinidad_Entidades_Anual_y_Trimestral_Ppales_Entidades/bin org.testng.TestNG testng.xml
Error: Could not find or load main class org.testng.TestNG
Caused by: java.lang.ClassNotFoundException: org.testng.TestNG
Build step 'Execute shell' marked build as failure
Finished: FAILURE


How could I solve this issue: Error: Could not find or load main class org.testng.TestNG ??

Thanks so much!
Reply all
Reply to author
Forward
0 new messages