Menu

Does DDTUnit support Selenium Remote Control

Ivan
2006-11-01
2012-09-16
  • Ivan

    Ivan - 2006-11-01

    I am using junit framework for running my Selenium testcases which works absolutely fine, however for running data driven testing I am currently trying to integrate DDTUnit with junit and run my selenium testcases by fetching the data from xml files however I am getting the following error on trace while running it via an ant script:-

    AccountTest] method testConstructorTheFirst error:
    [junit] junitx.ddtunit.data.DDTTestDataException: Could not find provided te
    stdata resource: /com/sharefare/ui/tests/account/DDT-MyClassResource.xml
    [junit] at junitx.ddtunit.data.DataRepository.restore(DataRepository.jav
    a:147)
    [junit] at junitx.ddtunit.data.DataRepository.get(DataRepository.java:11
    8)
    [junit] at junitx.ddtunit.DDTTestCase.initTestData(DDTTestCase.java:424)

    [junit]     at junitx.ddtunit.DDTTestCase.initTestData(DDTTestCase.java:411)
    
    [junit]     at com.sharefare.ui.tests.account.CreateUserAccountTest.initCont
    

    ext(CreateUserAccountTest.java:18)
    [junit] at junitx.ddtunit.DDTTestCase.runBare(DDTTestCase.java:162)
    [junit] at junitx.ddtunit.DDTTestResult$1.protect(DDTTestResult.java:181
    )
    [junit] at junitx.ddtunit.DDTTestResult.runProtected(DDTTestResult.java:
    199)
    [junit] at junitx.ddtunit.DDTTestResult.run(DDTTestResult.java:185)
    [junit] at junitx.ddtunit.DDTTestCase.run(DDTTestCase.java:140)
    [junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
    [junit] at junit.framework.TestSuite.run(TestSuite.java:203)
    [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
    run(JUnitTestRunner.java:289)
    [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
    launch(JUnitTestRunner.java:656)
    [junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
    main(JUnitTestRunner.java:558)
    [junit] Caused by: junitx.ddtunit.DDTException: Could not find provided test
    data resource: /com/sharefare/ui/tests/account/DDT-MyClassResource.xml
    [junit] at junitx.ddtunit.DDTException.create(DDTException.java:115)
    [junit] at junitx.ddtunit.data.processing.parser.ParserImpl.parse(Parser
    Impl.java:203)
    [junit] at junitx.ddtunit.data.XmlDataRestorer.restore(XmlDataRestorer.j
    ava:67)
    [junit] at junitx.ddtunit.data.DataRepository.restore(DataRepository.jav
    a:139)
    [junit] ... 14 more
    [junit] 0 INFO [MONITOR] [class com.sharefare.ui.tests.account.CreateUse
    rAccountTest]
    method "testConstructorTheFirst": 0 of -1 test(s), 0 error(s), 0 f
    ailure(s)
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.234 sec
    [junit] Test com.sharefare.ui.tests.account.CreateUserAccountTest FAILED

    Hence I come down to the basic question ? please can someone tell me if DDTUnit supports Selenium Remote Control ?

    Regards
    Ivan
    Software Engineer.

     
    • Ivan

      Ivan - 2006-11-03

      Hi Jorg,

      I tried out the url you gave me thanks for your help however I have to conclude that DDTUnit does not support Selenium Remote Control

      Sorry for the trouble and I appreciate your time

      Regards
      Ivan D'cunha

      Software Engineer

       
    • Joerg Gellien

      Joerg Gellien - 2006-11-01

      Hi Ivan,

      I am not sure what type of class Selenium Remote Control is. So the awnser will depend on your aims.
      But the exception

      junitx.ddtunit.data.DDTTestDataException: Could not find provided testdata resource: /com/sharefare/ui/tests/account/DDT-MyClassResource.xml

      states that there is no ddtunit testdata supplied where it is expected.
      It looks like you are using a test class about this type:

      package com.sharefare.ui.tests.account;
      class MyTest extends DDTTestCase{
      public initContext("MyClassResource");
      ...

      as default behavior DDTUnit will resolve the resource name to the one stated in the exception.

      Back to your question - my contra question
      How do you want to use the Selenium class in the testcase?
      Are you working on an instance of this class and DDTUnit should provide different configuration of this?

      If you like provide example tests and your ideas for more detailed discussion.

      best regards

      Joerg

       
    • Ivan

      Ivan - 2006-11-02

      Hi Joerg,

      I am using 3 classes basicly, one extends to DDTTestCase which fetches my data from my xml file, the second one which extends to SeleneseTestCase fetches data from the first one and sends the data to the third one all that the third one has to do is to execute the selenium commands however this is not happening
      here is a brief format of my 3 files.

      file 1:-
      import junitx.ddtunit.DDTTestCase;
      import com.thoughtworks.selenium.*;
      public class something extends DDTTestCase {
      protected void initContext() {
      initTestData("MyClassResource");
      System.out.println("testOne");
      }
      public void testConstructorTheFirst() throws Exception {
      CompositeValue subject = new CompositeValue((String) getObject("username"),
      (String) getObject("password"), (String) getObject("email"), (String) getObject("postalcode"), (String) getObject("url"));

              testingTest cust = new testingTest();   
          cust.testNew(url, username, password, email, postalcode);
      }
      

      }

      file 2:-
      import com.thoughtworks.selenium.*;
      public class testingTest extends SeleneseTestCase {
      public void testNew(String url, String username, String password, String email, String postalcode) throws Exception {
      temtUtilities au=new temtUtilities();
      au.createAccount(selenium, url, username,password,email, postalcode);
      }
      public void setUp() throws Exception {
      super.setUp();
      }

      file3:-
      import com.thoughtworks.selenium.*;
      public class temtUtilities extends SeleneseTestCase {
      public void createAccount(Selenium selenium, String url, String username, String password, String email, String postalcode) throws Exception {
      selenium.setContext("Test Open", "info");
      selenium.open(url);
      selenium.waitForPageToLoad("30000");
      selenium.click("link=Sign up for tork");
      selenium.waitForPageToLoad("30000");
      selenium.type("firstName", username);
      selenium.type("lastName", username);
      selenium.type("username", username);
      selenium.type("password", password);
      selenium.type("confirmedPassword", password);
      selenium.type("emailAddress", email);
      selenium.type("postalCode", postalcode);
      selenium.click("_finish");
      selenium.waitForPageToLoad("300000");
      selenium.click("//input[@value=' OK ']");
      selenium.waitForPageToLoad("300000");
      }}

      The xml data is recognixed fine however the selenium commands in file 3 are not getting recognized by me that is the real problem hence my query once again Does DDTUnit support selenium Remote Control testing tool??

      exception got is as follows:-
      testOne
      testTwo
      Str::Ivan
      Str::Ivan
      Str::Ivan@domnik.com
      Str::41154
      Str::http://ivan.domnik.com
      http://ivan.domnik.com
      0 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] Error method testConstructorTheFirst, test test20061231
      0 INFO [MONITOR] Cause:
      java.lang.NullPointerException
      at com.sharefare.ui.tests.library.AccountUtilities.createAccount(AccountUtilities.java:20)
      at com.sharefare.ui.tests.account.CreateUserAccountTest.testNew(CreateUserAccountTest.java:19)
      at com.sharefare.ui.tests.account.ADDTAccountTest.testConstructorTheFirst(ADDTAccountTest.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junitx.ddtunit.DDTTestCase.processMethodTest(DDTTestCase.java:522)
      at junitx.ddtunit.DDTTestCase.runMethodTest(DDTTestCase.java:485)
      at junitx.ddtunit.DDTTestCase.runBare(DDTTestCase.java:165)
      at junitx.ddtunit.DDTTestResult$1.protect(DDTTestResult.java:181)
      at junitx.ddtunit.DDTTestResult.runProtected(DDTTestResult.java:199)
      at junitx.ddtunit.DDTTestResult.run(DDTTestResult.java:185)
      at junitx.ddtunit.DDTTestCase.run(DDTTestCase.java:140)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      16 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] (1/2) method "testConstructorTheFirst", test "test20061231"
      testTwo
      Str::Manish
      Str::Manish
      Str::Manish@domnik.com
      Str::41154
      Str::http://ivan.domnik.com
      http://ivan.domnik.com
      16 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] Error method testConstructorTheFirst, test test20060101
      16 INFO [MONITOR] Cause:
      java.lang.NullPointerException
      at com.sharefare.ui.tests.library.AccountUtilities.createAccount(AccountUtilities.java:20)
      at com.sharefare.ui.tests.account.CreateUserAccountTest.testNew(CreateUserAccountTest.java:19)
      at com.sharefare.ui.tests.account.ADDTAccountTest.testConstructorTheFirst(ADDTAccountTest.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junitx.ddtunit.DDTTestCase.processMethodTest(DDTTestCase.java:522)
      at junitx.ddtunit.DDTTestCase.runMethodTest(DDTTestCase.java:485)
      at junitx.ddtunit.DDTTestCase.runBare(DDTTestCase.java:165)
      at junitx.ddtunit.DDTTestResult$1.protect(DDTTestResult.java:181)
      at junitx.ddtunit.DDTTestResult.runProtected(DDTTestResult.java:199)
      at junitx.ddtunit.DDTTestResult.run(DDTTestResult.java:185)
      at junitx.ddtunit.DDTTestCase.run(DDTTestCase.java:140)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      16 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] (2/2) method "testConstructorTheFirst", test "test20060101"
      16 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] method testConstructorTheFirst error:
      junitx.ddtunit.DDTException: method testConstructorTheFirst - Total: 2, Errors: 2, Failures: 0
      E-(test20061231) null
      E-(test20060101) null
      at com.sharefare.ui.tests.library.AccountUtilities.createAccount(AccountUtilities.java:20)
      at com.sharefare.ui.tests.account.CreateUserAccountTest.testNew(CreateUserAccountTest.java:19)
      at com.sharefare.ui.tests.account.ADDTAccountTest.testConstructorTheFirst(ADDTAccountTest.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junitx.ddtunit.DDTTestCase.processMethodTest(DDTTestCase.java:522)
      at junitx.ddtunit.DDTTestCase.runMethodTest(DDTTestCase.java:485)
      at junitx.ddtunit.DDTTestCase.runBare(DDTTestCase.java:165)
      at junitx.ddtunit.DDTTestResult$1.protect(DDTTestResult.java:181)
      at junitx.ddtunit.DDTTestResult.runProtected(DDTTestResult.java:199)
      at junitx.ddtunit.DDTTestResult.run(DDTTestResult.java:185)
      at junitx.ddtunit.DDTTestCase.run(DDTTestCase.java:140)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: java.lang.NullPointerException
      ... 19 more
      16 INFO [MONITOR] [class com.sharefare.ui.tests.account.ADDTAccountTest] method "testConstructorTheFirst": 2 of 2 test(s), 2 error(s), 0 failure(s)

      I appreciate your time and I await your quick response as this is urgent for me.

      Regards
      Ivan...
      Software Engineer

       
    • Joerg Gellien

      Joerg Gellien - 2006-11-02

      Hi Ivan,

      frankly speaking I never worked with Selenim before.
      So I am not sure what runtime is required for selenium tests.

      What DDTUnit provides is a direct extension of TestCase but with its own runtime extension for impicite execution of <test/> data sets.

      I found a link on SeleneseTestCase:
      http://svn.openqa.org/fisheye/viewrep/selenium-rc/trunk/clients/java/src/test/java/com/thoughtworks/selenium/SeleneseTestCase.java?r=1237

      As far as I can see it is important for this TestCase to process setUp() before doing method execution.
      The basic execution model in every JUnit TestRunner : setUp() - testMethod - tearDown().

      Perhaps this might help to find a solution.

      Best regards
      Jörg

       

Log in to post a comment.