Перейти к содержимому

Фотография

Почему появляется ошибка


  • Авторизуйтесь для ответа в теме
В теме одно сообщение

#1 z1987

z1987

    Новый участник

  • Members
  • Pip
  • 16 сообщений
  • ФИО:Зурабов Александр

Отправлено 04 февраля 2011 - 07:15

Здравствуйте.
Имеются тесты, написанные на Selenium+Junit+java. Код работает, но раз в 5 запусков где-то появляются ошибки в любом из 3х тестов или в вдвух сразу. В чем может быть причина. Также подскажите, пожалуйста, почему в конце после тестирования не отключаются окна браузера и окно selenium rc. Что я не так сделал?
Сам тест проверяет окно аутентификации.

Ошибка:

Testcase: testWrongPassword(com.test.TestAuthentication):        Caused an ERROR
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.  The error message is: Permission denied
com.thoughtworks.selenium.SeleniumException: ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window.  The error message is: Permission denied
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
        at com.thoughtworks.selenium.DefaultSelenium.type(DefaultSelenium.java:291)
        at com.test.TestAuthentication.authentication(TestAuthentication.java:45)
        at com.test.TestAuthentication.testWrongPassword(TestAuthentication.java:79)
        at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
или:
Testcase: testLanguageSelection(com.test.TestAuthentication):        Caused an ERROR
ERROR: Element login.english not found
com.thoughtworks.selenium.SeleniumException: ERROR: Element login.english not found
        at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
        at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
        at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:167)
        at com.test.TestAuthentication.testLanguageSelection(TestAuthentication.java:85)
        at com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:212)
Сам код:
public class TestAuthentication extends SeleneseTestCase {
    
    private final static String rightLogin = "rl";
    private final static String rightPassword = "rp";
    private final static String rightRadius = "rr";
    private final static String wrongLogin = "wl";
    private final static String wrongPassword = "wp";
    private final static String wrongRadius = "wr";
    
    private SeleniumServer seleniumServer = new SeleniumServer();
    final Logger logger = LoggerFactory.getLogger(TestAuthentication.class);

    public TestAuthentication() throws Exception {
        setUp("http://link.com","*iexplore");
        }
    
    public static void main(String[] args) {

        JUnitCore core = new JUnitCore();
        core.addListener(new CoreListener());
        core.run(TestAuthentication.class);
    }
    public boolean authentication(String usernameValue,String passwordValue,
            String radiusValue){
        
        selenium.open("http://link.com");
        selenium.waitForPageToLoad("30000");
	selenium.type("username", usernameValue);
	selenium.type("password", passwordValue);
	selenium.type("radius", radiusValue);
	selenium.click("submit");
        selenium.waitForPageToLoad("30000");
        
        return selenium.isElementPresent("logoutLink");
    }

    @Before
    public void setUpTest() throws Exception{

          seleniumServer.start();
          selenium.start();
      }

    @After
    public void tearDownTest()throws Exception{

         selenium.stop();
         seleniumServer.stop();
      }

    @Test
    public void testRightPassword() throws Exception {

        assertTrue(authentication(rightLogin,rightPassword, rightRadius));
        assertFalse(selenium.isElementPresent("xpath=//li[@class='errors']"));
        selenium.click("logoutLink");
        selenium.waitForPageToLoad("30000");
        
   }

    @Test
    public void testWrongPassword() throws Exception {
        assertFalse(authentication(wrongLogin,wrongPassword, wrongRadius));        
    }

  • 0

#2 z1987

z1987

    Новый участник

  • Members
  • Pip
  • 16 сообщений
  • ФИО:Зурабов Александр

Отправлено 04 февраля 2011 - 12:09

Ребят, еще одна проблема. Почему-то программа игнорирует аннотации и выполняет тесты как JUnit3, то есть если убрать слово test в начале названия тестов, то они не исполняются. В нетбинсе если создать заново юнит тест, то он нормально выполняется как junit4. Судя по всему дело в
public class TestAuthentication extends SeleneseTestCase {
Кто-то сталкивался с подобным?
  • 0


Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных