← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #247715]: Problem when build test with Eclipse/Maven/TestNG, NoClassDefFoundError

 

Question #247715 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/247715

Description changed to:
So I've tried and I've tried for a week now but I can't get it to work. I'm sorry. I've red many FAQs here on launchpad, but I really cant get it to work. Heres is my problem:
I have a Maven project in Eclipse with TestNG and Sikuli. When I run the test as Run as -> TestNG Test it works just fine. But when i run the test as Run as -> Maven test, I get this error: java.lang.NoClassDefFoundError: org/sikuli/script/FindFailed

Sikuli version = SikuliX Setup Build: 1.0.1


And here is how my environment looks like:
Java version:
C:\Sikuli X>java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

Java installed under:
C:\Program Files (x86)\Java\jdk1.7.0_55

Path looks like this:
C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Sikuli X\Sikuli-IDE\libs;%JAVA_HOME%\bin;

%SIKULI_HOME% = C:\Sikuli X\Sikuli-IDE
%JAVA_HOME% = C:\Program Files (x86)\Java\jdk1.7.0_55

http://s1048.photobucket.com/user/AutomatedTester/media/Img01_zpsfa634796.png.html?filters[user]=140045205&filters[recent]=1&sort=1&o=2

Here is my configuration in Eclipse:

http://s1048.photobucket.com/user/AutomatedTester/media/Img02_zpsa09f4c62.png.html?filters[user]=140045205&filters[recent]=1&sort=1&o=0


http://s1048.photobucket.com/user/AutomatedTester/media/Img03_zpsd948fd85.png.html?filters[user]=140045205&filters[recent]=1&sort=1&o=1

Test-case
package com.KvadratTest.KvadratTest;

import org.testng.Assert;
import org.testng.annotations.Test;

public class NewTest {
  @Test
  public void f() {
	  Assert.assertEquals(4, 4);
  }
  
  @Test
	 public void LoginValidUser() {

		LoginPage lp = new LoginPage();
		boolean vs = lp.ValidUser("100kalle", "kallekulahoppar");

		Assert.assertEquals(vs, true);
	}
}

Test-class
package com.KvadratTest.KvadratTest;

import org.sikuli.script.App;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.Screen;
import org.sikuli.script.*;


public class LoginPage {

	
	private Screen _s;
	private String NPath = "C:\\Users\\AutoTester\\AppData\\Roaming\\Spotify\\spotify.exe";

	public LoginPage()
	{
		Screen s = new Screen();
		this._s = s;
	}

	public Boolean ValidUser(String user, String password)
	{
		
		
		try
			{
				

				App.open(NPath);
				_s.wait("imgs/UserSpotify.png", 10);
				_s.type(user);
				_s.click("imgs/PasswordSpotify.png", 0);
				_s.type(password);
				_s.click("imgs/LoginSpotify.png", 0);
				_s.wait("imgs/ValiduserSpotify.png", 10); 
				_s.click("imgs/FileSpotifyClient.png"); 
				_s.wait("imgs/LogoutUserSpotify.png", 5);
				_s.click("imgs/LogoutUserSpotify.png"); 
				_s.click("imgs/ExitLogin.png");
				return true;
				
				
			}
				catch(FindFailed e)
				
			{
			e.printStackTrace();
			}
		return false;
	}


Error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.1:test (default-test) on project KvadratTest: There are test failures.


http://s1048.photobucket.com/user/AutomatedTester/media/Img04_zpsb972ac4a.png.html?filters[user]=140045205&filters[recent]=1&sort=1&o=3

So I really need help with this, I'm stuck :(

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.