0

I am initiating some Selenium tests from a TeamCity build. These tests run fine when I run them from comand with mvn test for example. But when running through Teamity we get the error message "Could not find or load main class Online".

From reaidng various articles with similar error I was thinking it's to do with Classpath so I made some changes to my system variables but problem persists.

I have put below my various system variables and also my project structure if this helps.

I'm a bit confused by the error message which states a class of 'Online' but I dont have a class called this in my project.

CLASSPATH = .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
JAVA_HOME = C:\Program Files\Java\jdk-9.0.4
JDK_HOME = %JAVA_HOME%
JRE_HOME = C:\TeamCity\jre
Path = C:\Projects\BDD\MDA Online Framework\Maven\apache-maven-3.5.4\bin;%JAVA_HOME%\bin;other path stuff here

Project structure:

MDA Online Framework
├───.idea
│   ├───dictionaries
│   └───libraries
├───Maven
│   └───apache-maven-3.5.4
│       ├───bin
│       ├───boot
│       ├───conf
│       │   └───logging
│       └───lib
│           ├───ext
│           └───jansi-native
│               ├───freebsd32
│               ├───freebsd64
│               ├───linux32
│               ├───linux64
│               ├───osx
│               ├───windows32
│               └───windows64
├───Reporting
│   ├───ADAWA
│   ├───DPL
│   ├───MOP
│   ├───MOS
│   ├───OA
│   ├───TPOS
│   └───wikipedia.html
├───run
├───Selenium
│   └───libs
├───src
│   ├───main
│   │   ├───java
│   │   └───resources
│   └───test
│       ├───java
│       │   ├───config
│       │   ├───Database
│       │   ├───Pages
│       │   └───stepdefs
│       │       ├───MOPStepDefs
│       │       ├───MOSStepDefs
│       │       ├───OAStepDefs
│       │       └───TPOSStepDefs
│       └───Resources
│           ├───MOP Features
│           ├───MOS Features
│           ├───Online Apps
│           └───TPOS
└───target
    ├───classes
    ├───generated-sources
    │   └───annotations
    ├───generated-test-sources
    │   └───test-annotations
    ├───maven-status
    │   └───maven-compiler-plugin
    │       ├───compile
    │       │   └───default-compile
    │       └───testCompile
    │           └───default-testCompile
    ├───surefire-reports
    └───test-classes
        ├───config
        ├───Database
        ├───MOP Features
        ├───MOS Features
        ├───Online Apps
        ├───Pages
        ├───stepdefs
        │   ├───MOPStepDefs
        │   ├───MOSStepDefs
        │   ├───OAStepDefs
        │   └───TPOSStepDefs
        └───TPOS
Matt
  • 501
  • 1
  • 12
  • 26
  • Online is a part of the path to maven and it contains spaces... i'm sure error linked to that. – daggett Aug 08 '18 at 08:06
  • you should compile before the test. try `mvn clean install test` – Senior Pomidor Aug 08 '18 at 08:55
  • Thanks @daggett My project folder is called 'MDA Online Framework' if this helps. Are you saying this cant contain spaces? I've updated the tree in my original post. – Matt Aug 08 '18 at 23:57
  • @daggett I found the problem and you were right about spaces. I put in some quote marks around that now and it works. Thanks a lot.Put this as an answer if you like and I can mark it as correct. – Matt Aug 09 '18 at 00:36

0 Answers0