2

I began to use Qooxdoo the last month so i've got very little experience in its usage. I need to create a test application like the testrunner on the Qooxdoo website, but i need to do tests inside my application environment. I followed these steps:

  • Created the application
  • Compiled the source version with generate.py source
  • Create the test with generate.py test

In this test if i try to access my application it gives me an error because its undefined.

Then reading the documentation on the website i've found that this type of tests must be done using generate.py test-source. But running the index-source.html in the test folder the result is the same: the application is not working.

What is the right way to this? What did I do wrong?

mck89
  • 18,918
  • 16
  • 89
  • 106
  • Can you be more specific about the errors you get? In the first case ("generate.py test"), what exactly was undefined? Did the runner application start? Did you see any tests in the tree menu? Or showed the error only when you ran the tests? Remember that qooxdoo's testrunner follows the JUnit approach, in that you have test classes that operate on dependent application classes. If you try to instantiate your main Application.js in a test, I think this will not work. – ThomasH Jan 17 '10 at 18:47
  • For instance in the main() method of the application i set a property "foo" on the application object. Inside the test i try to get that property in this way "qx.core.Init.getApplication().foo" but it's undefined so the only explanation is that the application is not initialised. – mck89 Jan 18 '10 at 08:11

1 Answers1

2

Using generate.py test or generate.py test-source create a testrunner for you application, like the one you have seen on the qooxdoo website. But your own testrunner contains every test you wrote in the test namespace of your application.

The testrunner is mainly designed for unit tests, which means testing single, small pieces of an application. For example if you have some kind of data manipulating object, you can easily test that by creating on of those objects like you do in the your application code. The same is true for not that small objects like your application. You can create an instance of your application in a unit test and access the methods on that application as well:

var app = new customNamespace.Application();
this.assertTrue(app.yourMethodName());

But if you really need to test the whole application at once, Selenium [1] could be a better choice. qooxdoo offers a users a Selenium user extension for easier handling qooxdoo applications.

[1] http://seleniumhq.org/

[2] http://qooxdoo.org/contrib/project/simulator

Martin Wittemann
  • 2,109
  • 1
  • 12
  • 14
  • Thanks for the answer, so there's no way at the moment to test the entire application using only qooxdoo testrunner – mck89 Jan 18 '10 at 08:13
  • Sorry i read better your answer and checked out the documentation and now i've understood what should i do. Thank you again. – mck89 Jan 18 '10 at 08:46