Selenium is a high quality open source test automation tool for web application testing . 셀레늄은 고품질의 오픈 소스 시험 자동화 도구를 웹 응용 프로그램을 테스트합니다. Selenium runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac, with plans to support Safari on iPhone soon. 인터넷 탐색기에서 실행 셀레늄, 모질라 및 파이어 폭스에서 윈도우, 리눅스, 매킨토시, 원정 여행의 맥, 사파리를 iphone를 지원하는 계획을 곧합니다. Selenium test scripts are portable, can be run from browsers (using Selenium IDE) or from JUNit or NGUnit (using Selenium RC) etc.. 셀레늄 테스트 스크립트는 휴대용에서 실행할 수있습니다 브라우저 (사용하는 셀레늄 ide) 또는 junit 또는 ngunit (셀레늄 이끌고를 사용하여) 등. For example, test scripts written using Selenium IDE in Firefox on Windows can run on Firefox in Mac or Linux, without changing any code. 예를 들어, 셀레늄 ide에서 firefox를 사용하여 테스트 스크립트를 작성 창은 firefox의 맥 또는 리눅스에서 실행, 임의의 코드를 변경하지 않고있습니다. Selenium tests run directly in browsers and so matches the end-user experience closely. 브라우저에서 직접 테스트를 실행 셀레늄 그리고 엔드 - 사용자 경험을 밀접하게 일치합니다.

There are three variants of Selenium, which can be used in isolation or in combination to create complete automation test suite for your web applications. 3 개의 변종의 셀레늄이 사용할 수있는 조합을 만들 격리 또는 웹 응용 프로그램을 완전 자동화 테스트 스위트 룸을합니다.

  • Selenium Core - In Selenium Core the tests scripts (written in HTML) and the Selenium Test Runner (written in Javascript) are uploaded to the same web server that hosts the application you are trying to test. 셀레늄 핵심 - 셀레늄 핵심이 테스트 스크립트 (작성된 html)과 셀레늄 테스트 러너 (작성된 자바 스크립트)는 동일한 웹 서버에 업로드를 호스팅하는 응용 프로그램을 테스트하려고합니다. It is a simpler form of Selenium, and suitable for non-developers, but it has some inherent limitations. 그것은 단순한 형태의 셀레늄, 그리고 적합 아닌 - 개발자, 그러나, 그것은 어떤 고유의 제한합니다.

  • Selenium IDE - Selenium IDE is a Firefox plugin, which includes the entire Selenium Core, allows you to record, play back, edit, and debug tests in browser. 셀레늄 ide - ide는 firefox 플러그 접속식 셀레늄을 포함하는 전체 셀레늄 코어,를 사용하면 기록, 재생, 편집하고, 브라우저에서 테스트 및 디버깅합니다. It provides the simplest introduction to Selenium and is highly recommended for beginners. 그것을 제공합니다 적극 추천에 대한 간단한 소개되어 초보자 셀레늄합니다. You can save the tests / test suite created in xml or html format. 실험을 저장할 수있습니다 / 테스트 스위트 룸에서 생성된 xml이나 형식합니다. However to run them in an automated fashion you need Selenium Remote Control which is described next. 그러나 그들을 실행하려면 원격 제어를하는 자동화된 패션 셀레늄에 대한 자세한 내용을 다음이 필요합니다.

  • Selenium Remote Control - The Selenium Remote Control allows you to develop test cases and test suites in Java (supports JUnit & NGUnit), PHP, Ruby, Python, Perl and even .NET. 셀레늄 원격 제어 - 셀레늄 원격 제어를 사용하면 테스트 케이스를 개발하고 테스트 스위트는 자바 (지원하는 junit & ngunit), php, 루비, 파이썬, 펄도합니다. 순수한합니다. It is the most flexible setup but requires some development knowledge to set up and use. 그것은 가장 유연한 설치 프로그램을하지만 일부 개발 지식을 설정하고 사용이 필요합니다.

  • Selenium Grid - Selenium Grid allows several Selenium Remote Control servers to be accessed in parallel by Selenium Grid server. 셀레늄 그리드 - 여러 셀레늄 셀레늄 그리드를 사용 원격 제어 서버에 접속하여 서버에 액세스 그리드 셀레늄을 병렬로합니다. This is extremely useful for automated load and stress testing of web applications. 이것은 매우 유용합니다 웹 응용 프로그램을 자동으로로드 및 스트레스 테스트를합니다.



Today we will discuss on how you can easily create automatic test scripts using Selenium IDE and convert them to JUnit tests (which uses Selenium Remote Control) which can be added to your JUnit based automatic regression test suite. 오늘 우리는 쉽게 만들 수있는 방법에 논의 자동으로 테스트 스크립트를 사용하여 그들을 junit 셀레늄 ide 및 전환 시험 (셀레늄을 사용하는 원격 제어) junit 수있는 기반 자동으로 회귀 테스트 스위트 룸에 추가됩니다.

How to create a test plan in Selenium IDE 셀레늄을 만드는 방법을 실험 계획에 ide


Creating a test plan in Selenium IDE is very easy, so we will use it to create few simple tests to begin with. 셀레늄을 만드는 실험 계획에 ide은 매우 간단합니다, 그래서 우리는이 도구를 사용하여 테스트를 시작하는 몇개의 단순한 작성합니다.

  • Install 설치 Selenium IDE 0.8.7 셀레늄 ide 0.8.7 , a Firefox plugin. , firefox 플러그 접속합니다.

  • After installing Selenium please restart your Firefox browser for the plugin to be activated. firefox를 설치한 후 브라우저를 다시 시작하십시오 플러그 접속식 셀레늄을 활성화합니다.

  • Now you should see a new added menu item named Selenium IDE under your Firefox Tools menu. 이제 새로 추가된 메뉴 항목이 나타납니다 firefox 도구 메뉴의 아래에 이름을 셀레늄 ide합니다.

  • Open / browse the site for which you want to prepare a test case. 열기 / 검색하고자하는 사이트를 테스트 케이스를 준비하는 것입니다.

  • Start Selenium IDE from Firefox Tools->Selenium IDE . 셀레늄을 시작부터 firefox 도구를 ide -> 셀레늄 ide합니다.

  • Browse some pages. 브라 우즈 일부 페이지합니다.

  • Now click red button to stop recording. 현재 녹음을 중단 빨간 버튼을 클릭합니다.


At this point you will see Selenium automatically recording your actions. 셀레늄을 자동으로 녹음이 시점에서 당신의 행동가 나타납니다. Carefully note the commands, target and value. 신중하게 참고 : 명령을, 대상 및 값합니다. You can create and insert your own commands/ modify or even delete them. 자신의 명령을 삽입을 만들 수있습니다 / 수정 혹은 삭제할 수있습니다. We will show some examples below. 우리가보기 아래에 몇 가지 예입니다. In the next section we will see how we can modify the generated tests to suit our needs. 보고하는 방법은 다음 섹션에서 우리는 우리의 필요에 맞게 수정할 수있습니다 테스트를 생성합니다.

How to create / modify / delete Selenium commands 를 만드는 방법 / 수정 / 삭제 명령을 셀레늄


The default commands generated by Selenium when you are browsing the page as a normal user should be modified to make the test more robust and to add test cases to it. 셀레늄의 기본 명령을 생성하는 경우 일반 사용자로서 브라우징 페이지를 업데이 트해야합니다 위해 반드시 필요한 테스트의 경우 테스트를 더 강력하고 그것을 추가합니다.

  • Let's replace all click commands by clickAndWait . click simply clicks the specified link and goes on to execute the next command without waiting. clickandwait를 클릭하여 명령을하자 모두 교체합니다.를 클릭하지 않는 링크를 클릭하는 것은 단순히 무대에서 대기 시간없이 다음 명령을 실행합니다. On the other hand clickAndWait waits for the new page to loaded before executing the next command. clickAndWait should be used to make more robust test cases. 반면에 새로운 페이지를 로드할 clickandwait을 기다립니다의 다음 명령을 실행하기 전에합니다. clickandwait 시험의 경우 더 강력한을 만드는 데 사용한되어야합니다.

  • Insert assertTextNotPresent command after each clickAndWait command to confirm a text must not be present in the browsed page. asserttextnotpresent 명령을 삽입을 확인 후 각 clickandwait 명령을 탐색 페이지에있는 텍스트를해서는 안됩니다.

  • Use assertTextPresent command to confirm a text must be present in the browsed page. asserttextpresent을 사용 명령을 확인하는 탐색 페이지의 텍스트를이 반드시 존재해야합니다.

  • Finally to test your test plan please click green arrow button to play from the begining or to play from start point. 마지막으로 귀하의 테스트 계획을 테스트 녹색 화살표 버튼을 클릭하십시오 플레이부터 시작하거나 처음부터 포인트를 재생합니다.

  • Export the test plan as java file by Selenium IDE File->Export Test As->Java - Selenium RC (for example the file name is SeleniumSTSanityTest.java ) 셀레늄은 시험 계획을 수출로 파일을 자바 ide 파일 -> 내보내기 테스트를 -> 자바 - 셀레늄 이끌고 (예를 들어 파일 이름은 seleniumstsanitytest.java)

  • Then close your Firefox Selenium ID. 귀하의 firefox 셀레늄 번호를 닫습니다.



How to run above test plan (automatically generated java file from Selenium IDE) in command line? 위의 테스트를 실행하는 방법에 계획 (자바 파일을 자동으로 생성 셀레늄 ide)을 커맨드 라인?

  • Download 다운로드 Selenium RC 셀레늄 이끌고 . 합니다.

  • Unzip it under the same directory where SeleniumSTSanityTest.java (exported test plan as java file from Selenium ID) was saved. 같은 디렉토리에있는 지퍼를 여는 밑에 그것 seleniumstsanitytest.java (내보낸 시험 계획으로 자바 파일을 셀레늄 번호)를 저장합니다.

  • Install junit. junit을 설치합니다.

  • Go to directory where you unzip selenium-remote-control-1.0-beta-1-dist.zip file. 디렉토리로 이동 셀레늄 어디로 압축 해제 - 원격 - 제어 - 1.0 - 베타 - 1 - dist.zip 파일을합니다.

  • Open a terminal and do the steps below- 터미널과 최선을 단계를 따르십시오를 엽니다 -

    • cd selenium-remote-control-1.0-beta-1/selenium-server-1.0-beta-1 cd selenium-remote-control-1.0-beta-1/selenium-server-1.0-beta-1

    • java -jar selenium-server.jar (to run the server in interactive mode execute java -jar selenium-server.jar -interactive) 자바 - 병 셀레늄 - server.jar (대화형 모드를 실행하는 서버에서 실행 자바 - 병 셀레늄 - server.jar - 대화형)

    • If you get an error like Error: com.thoughtworks.selenium.SeleniumException: ERROR Server Exception: sessionId should not be null; has this session been started yet? then ensure that the browser is in the PATH before running the server. 오류가 같은 문제가 발생할 경우 언제 오류 : com.thoughtworks.selenium.seleniumexception : 오류 서버 예외 : sessionid가되지 않습니다 널;은이 세션이 아직 시작? 그러 고 나서 확인을 실행하기 전에 브라우저는 서버의 경로합니다. For example, you want to run the test in Firefox. 예를 들어, firefox에서 테스트를 실행합니다. Then you should do next two steps. 그렇다면 다음 두 단계를해야합니다.

    • locate firefox-bin (for example it returns /usr/lib/firefox-1.5.0.12/firefox-bin) firefox를 찾습니다 - 빈 (예를 들어을 반환 / usr/lib/firefox-1.5.0.12/firefox-bin)

    • export PATH=$PATH:/usr/lib/firefox-1.5.0.12/firefox-bin; 수출 경로를 = $ 경로 : / usr/lib/firefox-1.5.0.12/firefox-bin;
      Note: There is an alternative way to fix above error (browser is not in path). 참고 사항 : 위의 오류를 수정 방식의 대안이 (브라우저는이 경로). Simply replace chrome with browser PATH in SeleniumSTSanityTest.java file. 크롬으로 대체 브라우저를 seleniumstsanitytest.java 경로에 파일을 간단하게합니다. For example: 예를 들면 :
      line
      setUp("http://blog.taragana.com", "*chrome"); 설치 프로그램 ( "http://blog.taragana.com", "* 크롬");
      becomes
      setUp("http://blog.taragana.com", "*firefox /usr/lib/firefox-1.5.0.12/firefox-bin"); 설치 프로그램 ( "http://blog.taragana.com", "* 파이어 폭스 / usr/lib/firefox-1.5.0.12/firefox-bin");
      in SeleniumSTSanityTest.java .seleniumstsanitytest.java합니다.
      To run the test in opera browser replace chrome with opera . 오페라 브라우저에서 테스트를 실행합니다 크롬과 오페라를 대체합니다.


    Now the selenium server is running and you have to run the Java client located in selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1. 이제는 서버가 실행중인 셀레늄 그리고 당신은 자바 클라이언트를 실행하는 위치에 selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1합니다.

  • Open another terminal. 또 다른 터미널 오픈합니다.

    • export CLASSPATH=.:selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1/selenium-java-client-driver.jar:/usr/share/java/junit.jar 수출 클래스 =. : selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1/selenium-java-client-driver.jar : / usr / 공유 / 자바 / junit합니다. 병

    • javac SeleniumSTSanityTest.java javac seleniumstsanitytest.java

    • java SeleniumSTSanityTest 자바 seleniumstsanitytest




The automatically generated java file SeleniumSTSanityTest.java is likely to have some defects. 자바 파일을 자동으로 생성 seleniumstsanitytest.java는 결함이있다. Fix it by comparing with the example below: 아래 예제와 비교하여 고치 :




import com.thoughtworks.selenium.*; 수입 com.thoughtworks.selenium .*;
import junit.framework.*; 수입 junit.framework .*;
import java.util.regex.Pattern; 수입 java.util.regex.pattern;

public class SeleniumSTSanityTest extends SeleneseTestCase { 공용 클래스 selenesetestcase (seleniumstsanitytest 연장
public void setUp() throws Exception { 공공 무효 설치 프로그램을 () 예외 예외가 (
setUp("http://blog.taragana.com", "*chrome"); // to run the test in opera replace chrome with opera 설치 프로그램 ( "http://blog.taragana.com", "* 크롬"); / /를 실행하는 시험에 크롬을 대체할 오페라 오페라
} )
public void testSimpleThoughts() throws Exception { 공공 무효 testsimplethoughts () 예외 예외가 (
selenium.open(""); (""); selenium.open
assertFalse(selenium.isTextPresent("WordPress database error: [")); assertfalse (selenium.istextpresent ( "wordpress 데이터베이스 오류 : ["));
assertTrue(selenium.isTextPresent("2003-2008")); asserttrue (selenium.istextpresent ( "2003-2008"));
selenium.open("/index.php/category/programming/java"); selenium.open ( "/ index.php / 카테고리 / 프로그래밍 / 자바");
selenium.waitForPageToLoad("30000"); selenium.waitforpagetoload ( "30000");
assertFalse(selenium.isTextPresent("WordPress database error: [")); assertfalse (selenium.istextpresent ( "wordpress 데이터베이스 오류 : ["));
assertTrue(selenium.isTextPresent("2003-2008")); asserttrue (selenium.istextpresent ( "2003-2008"));
selenium.click("//img[@alt='Übersetzen Sie zum Deutsch/German']"); selenium.click ( "/ / 공간 [@ alt = 'übersetzen 곳의 zum deutsch / 독일 ']");
selenium.waitForPageToLoad("30000"); selenium.waitforpagetoload ( "30000");
assertFalse(selenium.isTextPresent("WordPress database error: [")); assertfalse (selenium.istextpresent ( "wordpress 데이터베이스 오류 : ["));
assertTrue(selenium.isTextPresent("2003-")); asserttrue (selenium.istextpresent ( "2003 -"));
selenium.click("//img[@alt='Přeložit do Čech/Czech']"); selenium.click ( "/ / 공간 [@ alt = 'přeložit하지 čech / 체코어 ']");
selenium.waitForPageToLoad("60000"); selenium.waitforpagetoload ( "60000");
assertFalse(selenium.isTextPresent("WordPress database error: [")); assertfalse (selenium.istextpresent ( "wordpress 데이터베이스 오류 : ["));
assertTrue(selenium.isTextPresent("2003")); asserttrue (selenium.istextpresent ( "2003"));
} )

public static Test suite() { 공공 정적 테스트 스위트 () (
return new TestSuite(SeleniumSTSanityTest.class); 반환 새로운 테스트 제품군 (seleniumstsanitytest.class);
} )

public static void main(String args[]) { 공공 정적 무효 메인 (문자열 args []) (
junit.textui.TestRunner.run(suite()); junit.textui.testrunner.run (스위트 룸 ());
} )
} )



Let me know if you have any comments / suggestions on how we can improve this tutorial. 의견이 있으시면 알려주세요 / 제안 사항을 개선할 수있는 방법이이 자습서합니다.