Django and Windmill Javascript testing

2011-06-21 Thread mt
Hi All,
This is a follow up to a recent thread on testing javascript in django
with qunit 
http://groups.google.com/group/django-developers/browse_frm/thread/e0656d72e5e863d7

We did some work at the Djangocon.eu sprint on integration testing of
Django with Windmill, which should be complementary to the qunit work,
qunit does proper unit testing, windmill is more for integration
testing (http://en.wikipedia.org/wiki/Integration_testing)

I've made a quick branch to demo this, here's how to get it running:

git clone g...@github.com:mthornhill/django.git djangowindmill
cd djangowindmill/
git fetch origin windmill:windmill
git checkout windmill
virtualenv . --no-site-packages
pip install windmill
export PYTHONPATH=$PWD
cd tests/
./runtests.py --settings=test_sqlite admin_integration

dependencies are
windmill http://www.getwindmill.com/
git http://git-scm.com/
virtualenv http://pypi.python.org/pypi/virtualenv
google chrome browser http://www.google.com/chrome/

You should see google chrome pop up and run through a simple test of
adding a user to the admin interface,
We've started using this on django-lfs (https://bitbucket.org/
diefenbach/django-lfs) and it works well with django-jenkins (https://
github.com/kmmbvnr/django-jenkins) when run under xvfb (http://
en.wikipedia.org/wiki/Xvfb) for headless testing
Windmill docs are here: https://github.com/windmill/windmill/wiki/_pages

Recording of tests is achieved by
1. Start your dev server: ./manage.py runserver
2. Start windmill with your browser of choice: windmill firefox
http://localhost:8000
3. From the windmill menu start recording
4. Navigate through the test you wish to perform by clicking in
browser
5. Save your test, you will get a list of python commands that emulate
the test
6. Plug your test into your test cases: e.g. see tests/regressiontests/
admin_integration/tests.py in checkout above

Hopefully this will be of use to someone.
Thanks
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Javascript Testing

2011-06-20 Thread Sean Bleier
Hi Luke,

This looks like it could be really interesting or useful, but at the
> moment I can't quite see my way to working out how to use it. I'd really
> like to be able to:
>
> 1) apply a patch (or two) to my copy of Django
>

Would you like me to attach a patch to a ticket? I could attach it to
https://code.djangoproject.com/ticket/16193 or open a new ticket using a
more generic description of a javascript testing framework.


> 2) run an example test that proves something useful about the admin's
> javascript (for instance - or some other example app that is provided).
>
>
I recently added tests for URLify.js from the admin, that may give you a
better practical sense of how to test the admin.
https://github.com/sebleier/django/commit/3a358cc3a4c2fa9a1fda0d58c46309c9f7956d6a


Thanks,

--Sean

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Javascript Testing

2011-06-18 Thread Justin Holmes
A javascript testing framework is most desirable.  Thanks for your
work so far - what can we do?

On Sat, Jun 18, 2011 at 8:15 PM, Julien Phalip <jpha...@gmail.com> wrote:
> Hi Sean,
>
> On Jun 18, 4:24 am, Sean Bleier <seble...@gmail.com> wrote:
>> Hello everyone,
>>
>> A couple months ago I started work on a django branch [1] (with the help of
>> @jezdez) that introduces a framework for writing javascript unit tests using
>> QUnit[2].  I started with QUnit because Django already included jQuery in
>> the admin and seemed like a natural extension, but it would be nice to hear
>> opinions from people that know more about javascript testing than I.
>>
>> Since I haven't touch it in a couple months, I thought I would share it with
>> django-developers to get some more eyes on it and discuss any missing
>> features or implementation details. It also be nice if Idan or any other
>> designery person could look it over and give some UI/UX advice.
>>
>> Just to give a overview, the javascript testing framework is initiated by
>> first collecting static media and then starting a special runserver:
>>
>>     ./manage.py collectstatic
>>     ./manage.py jstest
>>
>> This starts a runserver that collects and serves everything you need to run
>> the javascript tests found within an installed app. More detail can be found
>> in these preliminary docs[3], though they need to be moved into their proper
>> place within the docs directory.
>>
>> I'm hoping we can figure out a way forward so that we can start writing
>> tests for the admin and elsewhere.
>>
>> Cheers,
>>
>> --Sean
>>
>> [1]https://github.com/sebleier/django/tree/qunit
>> [2]http://docs.jquery.com/Qunit
>> [3]https://github.com/sebleier/django/blob/qunit/django/test/javascript/...
>
> Thanks a lot for working on this. Django is in dire need of a solid
> javascript test framework.
>
> I've actually been looking at this branch a few weeks ago and it's
> looking very promising! I had a few remarks and questions.
>
> Do you have any specific plans for testing the admin *interface*? My
> main concern is that to properly test complex interactions (e.g.
> dynamically adding or removing admin inlines), you would need to have
> a DOM based on the up-to-date admin templates and on some test data.
> Is it envisaged to plug the QUnit test platform in with a running
> instance of Django that would supply admin pages on the fly, or
> perhaps to introduce a management command that would generate HTML
> files using the up-to-date admin codebase?
>
> Also, one curse of javascript is that it doesn't always behave quite
> the same on all browsers. It would be absolutely awesome if the
> process of testing on multiple platforms and browsers could be
> automated in a CI environment. The Mozilla guys have done some work in
> that area: https://github.com/kumar303/jstestnet -- I haven't tried it
> myself yet. Do you think this could be looked into for Django itself?
>
> Then, as currently in your branch, QUnit tests are expected to be put
> in a "tests/javascript/" folder. Does it mean that the same folder
> structure can be used to run other types of JS test runners? If not,
> would it be best to use a more explicit structure and require that
> tests be put in, for example, "tests/qunit/", in order to leave the
> room for other JS test runners to be supported in the future?
>
> Finally, a ticket has recently been created in Trac for this:
> https://code.djangoproject.com/ticket/16193 -- 'mbraak' posted a patch
> with a few simple tests for the admin JS. It'd be great to see how
> both your works integrate.
>
> Thanks again, this is awesome!
>
> Julien
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django developers" group.
> To post to this group, send email to django-developers@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-developers+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-developers?hl=en.
>
>



-- 
Justin Holmes

Head Instructor, SlashRoot Collective
SlashRoot: Coffee House and Tech Dojo
60 Main Street
New Paltz, NY 12561
845.633.8330

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Javascript Testing

2011-06-18 Thread Julien Phalip
Hi Sean,

On Jun 18, 4:24 am, Sean Bleier <seble...@gmail.com> wrote:
> Hello everyone,
>
> A couple months ago I started work on a django branch [1] (with the help of
> @jezdez) that introduces a framework for writing javascript unit tests using
> QUnit[2].  I started with QUnit because Django already included jQuery in
> the admin and seemed like a natural extension, but it would be nice to hear
> opinions from people that know more about javascript testing than I.
>
> Since I haven't touch it in a couple months, I thought I would share it with
> django-developers to get some more eyes on it and discuss any missing
> features or implementation details. It also be nice if Idan or any other
> designery person could look it over and give some UI/UX advice.
>
> Just to give a overview, the javascript testing framework is initiated by
> first collecting static media and then starting a special runserver:
>
>     ./manage.py collectstatic
>     ./manage.py jstest
>
> This starts a runserver that collects and serves everything you need to run
> the javascript tests found within an installed app. More detail can be found
> in these preliminary docs[3], though they need to be moved into their proper
> place within the docs directory.
>
> I'm hoping we can figure out a way forward so that we can start writing
> tests for the admin and elsewhere.
>
> Cheers,
>
> --Sean
>
> [1]https://github.com/sebleier/django/tree/qunit
> [2]http://docs.jquery.com/Qunit
> [3]https://github.com/sebleier/django/blob/qunit/django/test/javascript/...

Thanks a lot for working on this. Django is in dire need of a solid
javascript test framework.

I've actually been looking at this branch a few weeks ago and it's
looking very promising! I had a few remarks and questions.

Do you have any specific plans for testing the admin *interface*? My
main concern is that to properly test complex interactions (e.g.
dynamically adding or removing admin inlines), you would need to have
a DOM based on the up-to-date admin templates and on some test data.
Is it envisaged to plug the QUnit test platform in with a running
instance of Django that would supply admin pages on the fly, or
perhaps to introduce a management command that would generate HTML
files using the up-to-date admin codebase?

Also, one curse of javascript is that it doesn't always behave quite
the same on all browsers. It would be absolutely awesome if the
process of testing on multiple platforms and browsers could be
automated in a CI environment. The Mozilla guys have done some work in
that area: https://github.com/kumar303/jstestnet -- I haven't tried it
myself yet. Do you think this could be looked into for Django itself?

Then, as currently in your branch, QUnit tests are expected to be put
in a "tests/javascript/" folder. Does it mean that the same folder
structure can be used to run other types of JS test runners? If not,
would it be best to use a more explicit structure and require that
tests be put in, for example, "tests/qunit/", in order to leave the
room for other JS test runners to be supported in the future?

Finally, a ticket has recently been created in Trac for this:
https://code.djangoproject.com/ticket/16193 -- 'mbraak' posted a patch
with a few simple tests for the admin JS. It'd be great to see how
both your works integrate.

Thanks again, this is awesome!

Julien

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Javascript Testing

2011-06-18 Thread Luke Plant
Hi Sean,

> A couple months ago I started work on a django branch [1] (with the help
> of @jezdez) that introduces a framework for writing javascript unit
> tests using QUnit[2].  I started with QUnit because Django already
> included jQuery in the admin and seemed like a natural extension, but it
> would be nice to hear opinions from people that know more about
> javascript testing than I.
> 
> Since I haven't touch it in a couple months, I thought I would share it
> with django-developers to get some more eyes on it and discuss any
> missing features or implementation details. It also be nice if Idan or
> any other designery person could look it over and give some UI/UX advice.
> 
> Just to give a overview, the javascript testing framework is initiated
> by first collecting static media and then starting a special runserver:
> 
> ./manage.py collectstatic
> ./manage.py jstest
> 
> This starts a runserver that collects and serves everything you need to
> run the javascript tests found within an installed app. More detail can
> be found in these preliminary docs[3], though they need to be moved into
> their proper place within the docs directory.
> 
> I'm hoping we can figure out a way forward so that we can start writing
> tests for the admin and elsewhere.

This looks like it could be really interesting or useful, but at the
moment I can't quite see my way to working out how to use it. I'd really
like to be able to:

1) apply a patch (or two) to my copy of Django
2) run an example test that proves something useful about the admin's
javascript (for instance - or some other example app that is provided).

Remember, most of us (certainly me) probably don't know the first thing
about QUnit, and don't know if it is going to be useful for testing.

Regards,

Luke

-- 
LORENZ'S LAW OF MECHANICAL REPAIR:
After your hands become coated with grease, your nose will begin to
itch.

Luke Plant || http://lukeplant.me.uk/

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Javascript Testing

2011-06-17 Thread Sean Bleier
Hello everyone,

A couple months ago I started work on a django branch [1] (with the help of
@jezdez) that introduces a framework for writing javascript unit tests using
QUnit[2].  I started with QUnit because Django already included jQuery in
the admin and seemed like a natural extension, but it would be nice to hear
opinions from people that know more about javascript testing than I.

Since I haven't touch it in a couple months, I thought I would share it with
django-developers to get some more eyes on it and discuss any missing
features or implementation details. It also be nice if Idan or any other
designery person could look it over and give some UI/UX advice.

Just to give a overview, the javascript testing framework is initiated by
first collecting static media and then starting a special runserver:

./manage.py collectstatic
./manage.py jstest

This starts a runserver that collects and serves everything you need to run
the javascript tests found within an installed app. More detail can be found
in these preliminary docs[3], though they need to be moved into their proper
place within the docs directory.

I'm hoping we can figure out a way forward so that we can start writing
tests for the admin and elsewhere.

Cheers,

--Sean


[1] https://github.com/sebleier/django/tree/qunit
[2] http://docs.jquery.com/Qunit
[3]
https://github.com/sebleier/django/blob/qunit/django/test/javascript/__init__.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.