... ... 能性をテストするために使います。また、Django はこれらのフレームワーク向けの特別なサポートも提供しています。詳細については、 LiveServerTestCase のセクションを読んでください。 包括的なテストスイートを実現するには、これらすべてのタイプのテストを組み合わせて行うべきです ... ( mail . outbox [ 0 ] . subject , "Contact Form" ) self . assertEqual ( mail . outbox [ 0 ] . body , "I like your site" ) LiveServerTestCase class LiveServerTestCase [ソース] LiveServerTestCase は TransactionTestCase とほぼ同じですが、セットアップ時に実際の Djang ... トに割り当てるために使われるポート 0 にバインドします。サーバーの URL はテスト中は self.live_server_url でアクセスできます。 LiveServerTestCase の使用方法を紹介するために、Selenium テストを書いてみましょう。最初に、 selenium パッケージをインストールする必要があります ... ... など) ではなくローカル ( media/ など) の場合にのみ動作します。 テスト ビルトインのテストクライアント (たとえば、ビルトインの LiveServerTestCase ) ではなく実際の HTTP リクエストを使用してテストを実行している場合、テスト環境が現実の環境をできるだけ忠実に再現できるよう ... に、他のコンテンツと同じように静的アセットも配信する必要があります。しかし、 LiveServerTestCase はとても基本的な静的ファイル配信機能しかないため、 staticfiles アプリケーションの探索機能はなく、すでに静的コンテンツは ST ... TIC_ROOT に集められていることを前提にしています。 このため、 staticfiles は独自の django.contrib.staticfiles.testing.StaticLiveServerTestCase を同梱しています。これは組み込みのサブクラスで、開発時に DEBUG = True を指定した場合と非常によく似た方法で、つまり collect ... ... L 9.2 is the last version to support it. Also, the minimum supported version of psycopg2 is increased from 2.4.5 to 2.5.4. LiveServerTestCase binds to port zero Rather than taking a port range and iterating to find a free port, LiveServerTestCase binds to port zer ... is no longer used, and as it's also no longer used, the manage.py test --liveserver option is removed. If you need to bind LiveServerTestCase to a specific port, use the port attribute added in Django 1.11.2. django.contrib.auth や i18n ビューでの安全でないリダイレ ... ... t or use ABSOLUTE_URL_OVERRIDES if you want a URL for your user. The static asset-serving functionality of the django.test.LiveServerTestCase class has been simplified: Now it's only able to serve content already present in STATIC_ROOT when tests are run. The abil ... ives in the staticfiles application (the one actually in charge of such feature): django.contrib.staticfiles.testing.StaticLiveServerTestCase . In other words, LiveServerTestCase itself is less powerful but at the same time has less magic. Rationale behind this is ... ... であり、 本番環境で使用するべきではありません 。 「ライブテスト」をサポートするための特別なテストケース class testing. StaticLiveServerTestCase この unittest の TestCase サブクラスは django.test.LiveServerTestCase を拡張しています。 親と同様に、テスト対象のコードを実 ... ... hasn't been ported to Python 3 yet, including: the MySQL database backend (depends on MySQLdb) ImageField (depends on PIL) LiveServerTestCase (depends on Selenium WebDriver) Further, Django's more than a web framework; it's an ecosystem of pluggable components. At ... ... 内では無効です。加えて、トランザクションがサポートされるバックエンドのみで有効です (最も重要な例外は MyISAM です)。これは、 LiveServerTestCase や StaticLiveServerTestCase といった TransactionTestCase に依存するテストに関しても同様です。 Djangoは、 TestCase や Trans ... ... るで本物の人間がブラウザを操作しているかのように見えるんです! Django には、Selenium のようなツールとの連携を容易にしてくれる LiveServerTestCase が用意されています。 複雑なアプリケーションを開発する時には、継続的インテグレーション ( continuous integration ) のために、 ... ... testing frameworks Django 1.4 supports integration with in-browser testing frameworks like Selenium . The new django.test.LiveServerTestCase base class lets you test the interactions between your site's front and back ends more comprehensively. See the documentat ... 2026年10月08日