Выглядит вполне правильно. Надо подумать... Какая версия Selenium используется, и какая версия LoggingSelenium? Попробую воспроизвести/
LoggingSelenium
Автор Biasha, 16 янв 2009 12:20
Сообщений в теме: 26
#21
Отправлено 12 мая 2011 - 12:03
Алексей Баранцев
Тренинги для тестировщиков (тестирование производительности, защищенности, тест-дизайн, автоматизация):
Линейка тренингов по Selenium
Тренинги для тестировщиков (тестирование производительности, защищенности, тест-дизайн, автоматизация):
Линейка тренингов по Selenium
#23
Отправлено 13 мая 2011 - 11:01
Начало работать если вручную перед запуском запустить сервер. Как сделать чтоб он сам запускался ?
#24
Отправлено 08 июня 2011 - 06:21
Добрый вечер! Подскажите, пожалуйста, есть ли какие-либо инструменты для создания отчетов о прохождении selenium-тестов, используемые для SeleniumRC (php) + phpunit
#25
Отправлено 18 августа 2011 - 10:39
Решила попробовать LoggingSelenium (использую selenium + java + eclipse)- при запуске теста получается
java.lang.NoClassDefFoundError: org/apache/commons/lang/ArrayUtils
at com.unitedinternet.portal.selenium.utils.logging.LoggingBean.setArgs(LoggingBean.java:81)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.presetLoggingBean(LoggingCommandProcessor.java:325)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.doLogging(LoggingCommandProcessor.java:419)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.doCommand(LoggingCommandProcessor.java:146)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at test4.test(test4.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.ArrayUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 26 more
скачала c http://commons.apach...wnload_lang.cgi commons-lang3-3.0.1-bin.zip , добавила референс наcxommons-lang3-3.0.1.jar , сделала import org.apache.commons.*; import org.apache.commons.lang3.*;
Не помогло.
Вот сам тест:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.fail;
import com.thoughtworks.selenium.*;
import junit.framework.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Properties;
import java.util.ResourceBundle;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.HttpCommandProcessor;
import com.thoughtworks.selenium.Selenium;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
import junit.framework.TestCase;
import org.apache.log4j.*;
import org.apache.commons.*;
import org.apache.commons.lang3.*;
import com.unitedinternet.portal.selenium.utils.logging.HtmlResultFormatter;
import com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor;
import com.unitedinternet.portal.selenium.utils.logging.LoggingDefaultSelenium;
import com.unitedinternet.portal.selenium.utils.logging.LoggingResultsFormatter;
import com.unitedinternet.portal.selenium.utils.logging.LoggingUtils;
public class test4 extends SeleneseTestCase {
private Properties configProp = new Properties();
private DefaultSelenium selenium;
final String resultPath = "C:/SELENIUM/test/TestResults";
final String resultHtmlFileName = resultPath + File.separator + "result.html";
final String resultEncoding = "UTF-8";
//public static final Logger log=Logger.getLogger(test4.class);
@Before
public void setUp() {
BufferedWriter loggingWriter;
loggingWriter = LoggingUtils.createWriter(resultHtmlFileName, resultEncoding, true);
HtmlResultFormatter.setFILENAME_DATETIME_FORMAT(new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"));
LoggingResultsFormatter htmlFormatter = new HtmlResultFormatter(loggingWriter, resultEncoding);
htmlFormatter.setScreenShotBaseUri(""); // this is for linking to the screenshots
htmlFormatter.setAutomaticScreenshotPath(resultPath);
// wrap HttpCommandProcessor from remote-control
LoggingCommandProcessor myProcessor = new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*iexplore", "http://google.ru"), htmlFormatter);
selenium = new LoggingDefaultSelenium(myProcessor);
selenium.start();
}
@Test
public boolean checkText(String text) {
try { assertTrue(selenium.isTextPresent(text));
} catch (AssertionError ex) {
//log.error("Assertion failed. Text " + text + " is not present.");
//ex.printStackTrace();
return false;
}
return true;
}
public void test() {
//log.info("test1 is executing...");
selenium.open("/");
selenium.windowFocus();
selenium.windowMaximize();
selenium.setTimeout("10000");
selenium.type("//input[@id='lst-ib']", "fdfff");
selenium.click("//input[@name='btnK']");
selenium.setTimeout("1000");
String text1= new String("text to find blablabla");
checkText(text1);
assertTrue(selenium.isTextPresent(text1));
//verifyTrue(selenium.isTextPresent(text1));
selenium.close();
}
@After
public void tearDown() {
try {super.tearDown();}
catch (Exception e){}
finally {
selenium.stop();
}
}
java.lang.NoClassDefFoundError: org/apache/commons/lang/ArrayUtils
at com.unitedinternet.portal.selenium.utils.logging.LoggingBean.setArgs(LoggingBean.java:81)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.presetLoggingBean(LoggingCommandProcessor.java:325)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.doLogging(LoggingCommandProcessor.java:419)
at com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor.doCommand(LoggingCommandProcessor.java:146)
at com.thoughtworks.selenium.DefaultSelenium.open(DefaultSelenium.java:335)
at test4.test(test4.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.ArrayUtils
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 26 more
скачала c http://commons.apach...wnload_lang.cgi commons-lang3-3.0.1-bin.zip , добавила референс наcxommons-lang3-3.0.1.jar , сделала import org.apache.commons.*; import org.apache.commons.lang3.*;
Не помогло.
Вот сам тест:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.fail;
import com.thoughtworks.selenium.*;
import junit.framework.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Properties;
import java.util.ResourceBundle;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.HttpCommandProcessor;
import com.thoughtworks.selenium.Selenium;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
import junit.framework.TestCase;
import org.apache.log4j.*;
import org.apache.commons.*;
import org.apache.commons.lang3.*;
import com.unitedinternet.portal.selenium.utils.logging.HtmlResultFormatter;
import com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor;
import com.unitedinternet.portal.selenium.utils.logging.LoggingDefaultSelenium;
import com.unitedinternet.portal.selenium.utils.logging.LoggingResultsFormatter;
import com.unitedinternet.portal.selenium.utils.logging.LoggingUtils;
public class test4 extends SeleneseTestCase {
private Properties configProp = new Properties();
private DefaultSelenium selenium;
final String resultPath = "C:/SELENIUM/test/TestResults";
final String resultHtmlFileName = resultPath + File.separator + "result.html";
final String resultEncoding = "UTF-8";
//public static final Logger log=Logger.getLogger(test4.class);
@Before
public void setUp() {
BufferedWriter loggingWriter;
loggingWriter = LoggingUtils.createWriter(resultHtmlFileName, resultEncoding, true);
HtmlResultFormatter.setFILENAME_DATETIME_FORMAT(new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"));
LoggingResultsFormatter htmlFormatter = new HtmlResultFormatter(loggingWriter, resultEncoding);
htmlFormatter.setScreenShotBaseUri(""); // this is for linking to the screenshots
htmlFormatter.setAutomaticScreenshotPath(resultPath);
// wrap HttpCommandProcessor from remote-control
LoggingCommandProcessor myProcessor = new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*iexplore", "http://google.ru"), htmlFormatter);
selenium = new LoggingDefaultSelenium(myProcessor);
selenium.start();
}
@Test
public boolean checkText(String text) {
try { assertTrue(selenium.isTextPresent(text));
} catch (AssertionError ex) {
//log.error("Assertion failed. Text " + text + " is not present.");
//ex.printStackTrace();
return false;
}
return true;
}
public void test() {
//log.info("test1 is executing...");
selenium.open("/");
selenium.windowFocus();
selenium.windowMaximize();
selenium.setTimeout("10000");
selenium.type("//input[@id='lst-ib']", "fdfff");
selenium.click("//input[@name='btnK']");
selenium.setTimeout("1000");
String text1= new String("text to find blablabla");
checkText(text1);
assertTrue(selenium.isTextPresent(text1));
//verifyTrue(selenium.isTextPresent(text1));
selenium.close();
}
@After
public void tearDown() {
try {super.tearDown();}
catch (Exception e){}
finally {
selenium.stop();
}
}
#26
Отправлено 30 сентября 2011 - 10:25
скачайте более раннюю версию библиотеки, с версией 3 у меня тоже не захотело работать, скачал 2,4 все нормально. Качал отсюда http://www.java2s.co...nslang24jar.htm
#27
Отправлено 30 сентября 2011 - 10:28
настроил loggingSelenium, он делает скрин активной страницы, я запускаю тест из эклипса, активным остается он, скрин соответственно тоже эклипса. Подскажите как сделать скрин браузера, не делая его активным руками?
Количество пользователей, читающих эту тему: 1
0 пользователей, 1 гостей, 0 анонимных