Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    include Selenium Junit Test into Project/Ant

    We created our Selenium Test Cases in the Selenium IDE and they also worked there.
    Now I'm trying to integrate them into the the GTWproject to make automated test after every build with Ant.

    This is how i implemented the setup:

    @BeforeClass
    public static void setUpOnce() throws Exception {

    SeleniumServer seleniumserver;
    seleniumserver=new SeleniumServer();
    RemoteControlConfiguration a= seleniumserver.getConfiguration();
    File uimap=new File("\\user-extensions.js");

    a.setUserExtensions(uimap);

    seleniumserver.boot();

    seleniumserver.start();


    seleneseTestCase = new SeleneseTestCase();
    }
    ___________________________________________________

    This is one of the tests

    @Test
    public void testAddViewMitSelbenNamen() throws Exception {
    seleniumClient.open("/E2E_VoiceTM.html?gwt.codesvr=127.0.0.1:9997");
    seleniumClient.click("scLocator=//TreeGrid[ID=\"isc_TreeGrid_0\"]/body/row[2]/col[fieldName=nodeTitle||0]");
    seleniumClient.click("scLocator=//ToolStripButton[ID=\"isc_ToolStripButton_5\"]/");

    }

    ____________________________________________

    And this is the Error i get

    [junit] Testcase: testAddViewMitSelbenNamen(de.telekom.vtm.nb.gwt.client_test.AddViewMitSelbenNamenSeleniumTest): Caused an ERROR
    [junit] ERROR: Unrecognised locator type: 'sclocator'
    [junit] com.thoughtworks.selenium.SeleniumException: ERROR: Unrecognised locator type: 'sclocator'
    [junit] at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
    [junit] at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
    [junit] at com.thoughtworks.selenium.DefaultSelenium.click(DefaultSelenium.java:167)
    [junit] at de.telekom.vtm.nb.gwt.client_test.AddViewMitSelbenNamenSeleniumTest.testAddViewMitSelbenNamen(AddViewMitSelbenNamenSeleniumTest.java:13)
    [junit] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:423)
    [junit] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:137)

    BUILD FAILED

    _______________________________

    I thought i did everything i needed to make it work, so i can't figure out what the problem is.

    Thank you for Support

    #2
    Hello,
    Presently, I develop a regression test for a web application that uses some components of SmartGWT 2.4. I develop my test with Selenium solution with Selenium-IDE and RC. For Selenium, I use version 2.0b1 to create script test before with Selenium IDE. After, I export to java code. I use Eclipse Helios as editor and JUnit for Unit test.

    I added in selenium-IDE in the configuration the following Javascript file for Selenium core user-extensions-ide.js and user-extensions.js.

    I succeeded to create script test with selenium-IDE but when I export and run code. I got the same error message of L.Jarosch.mwea.

    I tried something with Selenium server to start it with Javascript file for user extensions but I got another error.

    Is there exist a solution to run adequately automated test between SmartGWT and selenium where sc_locator is found in XPath ?

    Is it better to use testNG for unit test ?

    Thanks in advance

    Rene

    Comment


      #3
      You need to load the user_extensions_sc.js file at playback time too if you are trying to do playback outside of the Selenium IDE. See the included instructions for details.

      Comment


        #4
        Hello,
        I would like to know where I can found file user_extensions_sc.js on the web ? What It does that another JS file doesn't not ?
        I suppose that I will need for Selenium IDE and possibly in RC with Java code or in command-line with selenium server.

        When I put file user-extensions.js in command-line for selenium server, I doesn't have the following I run the application.

        ERROR: Unrecognised locator type: 'sclocator'
        [junit] com.thoughtworks.selenium.SeleniumException: ERROR: Unrecognised locator type: 'sclocator'

        Thanks in advance for the time that you will take to my questions.

        Rene

        Comment


          #5
          Hello Isomorphic,

          You said -
          "You need to load the user_extensions_sc.js file at playback time too if you are trying to do playback outside of the Selenium IDE. See the included instructions for details."

          Can you tell me where to load the file. I cannot view the instructions.Can you please help

          Comment


            #6
            I also facing the same issue, did anyone find the way to run the test case using java code and to be able to find scLocator elements?

            Tomer.

            Comment


              #7
              Hi,

              I too got stuck with 'sclocator' while migrating my IDE scripts to RC. "Unrecognised locator type: 'sclocator' " is the error message displayed. Isomorphic, can you please let me know where to find user_extensions_sc.js??

              Comment


                #8
                See http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/AutomatedTesting.html

                It's in a directory in the SDK download.

                Comment


                  #9
                  Thanks for the reply. I got the user extensions from the latest version of sdk and now selenium server is identifying sclocator. Thanks a lot!

                  Comment

                  Working...
                  X