An even more fine grained solution may be using an HTML parser like
beautifulsoup. However, if your site's functionality depends on client side
features like JavaScript, Selenium may be a better alternative.
On 4 Nov 2015 18:33, "Dheerendra Rathor" <[email protected]> wrote:

> You can use unittest.TestCase.assertRegexpMatches for checking if form is
> present in rendered template.
> If you want to check the entire cycle (form loading, filling) you can use
> selenium for testing on live server.
>
> On Wed, 4 Nov 2015 at 22:08 Tim Chase <[email protected]>
> wrote:
>
>> Beginning a new project, I'd like to include functional testing in
>> addition to my unit tests.  What are recommended best practices for
>> exercising form-classes?  I was hoping to do something like
>>
>>   c = django.test.Client()
>>   results = c.get(page_url)
>>   frm = SomeForm()
>>   # pseudo-code for desired functional testing follows
>>   self.assertFormIn(frm, results) # check the form is used
>>   frm["name"] = "Pat Smith"
>>   frm["email"] = "[email protected]"
>>   results = c.post(page_url, frm) # submit the filled-out form
>>   # check results for error messages and/or success here
>>
>> Is there some piece of Django that I've missed that would facilitate
>> higher-level tests like this?
>>
>> Thanks,
>>
>> -tkc
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/20151104103632.38e014a4%40bigbox.christie.dr
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAByqUgj%2BeqyPr5b%2BVSu9AJ_45QZ5UgyrUn3G3pmxpSsN9SvHVg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAByqUgj%2BeqyPr5b%2BVSu9AJ_45QZ5UgyrUn3G3pmxpSsN9SvHVg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUJf9ipkbETNG5BqX1wwiBpR7z83Lwix8z1fM%2BD_E5Trfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to