Skip to content

Commit e4d42dc

Browse files
committed
tests.rst の翻訳
1 parent acf0bd9 commit e4d42dc

File tree

1 file changed

+26
-49
lines changed

1 file changed

+26
-49
lines changed

best_practices/tests.rst

Lines changed: 26 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
Tests
1+
テスト
22
=====
33

4-
Roughly speaking, there are two types of test. Unit testing allows you to
5-
test the input and output of specific functions. Functional testing allows
6-
you to command a "browser" where you browse to pages on your site, click
7-
links, fill out forms and assert that you see certain things on the page.
4+
大まかに言うと、テストには2つの種類が存在します。ユニットテストは、特定の関数の入力と出力をテストすることができます。機能テストは、あなたが閲覧するサイト上のページに対して "ブラウザ" を制御し、リンクをクリックしたり、フォームに記入を行ったり、ページ上の特定の物事を確認することができます。
85

9-
Unit Tests
6+
ユニットテスト
107
----------
118

12-
Unit tests are used to test your "business logic", which should live in classes
13-
that are independent of Symfony. For that reason, Symfony doesn't really
14-
have an opinion on what tools you use for unit testing. However, the most
15-
popular tools are `PhpUnit`_ and `PhpSpec`_.
9+
ユニットテストは、Symfonyから独立したクラス内に存在すべき、あなたの "ビジネスロジック" をテストするために使用されます。この理由により、Symfonyは実際のところ、ユニットテストのためにあなたがどのツールを使用するかについて意見を持ちません。しかしながら、最もポピュラーなツールは `PhpUnit`_ と `PhpSpec`_ です。
1610

17-
Functional Tests
18-
----------------
11+
機能テスト
12+
----------
1913

20-
Creating really good functional tests can be tough so some developers skip
21-
these completely. Don't skip the functional tests! By defining some *simple*
22-
functional tests, you can quickly spot any big errors before you deploy them:
14+
真に優れた機能テストを作成することは困難であるため、一部の開発者は完全にこれを省略します。機能テストを省略しないでください!いくつかの *シンプルな* 機能テストを定義することで、いかなる大きなエラーであれ、それらをデプロイしてしまう前にすばやく発見できます。
2315

2416
.. best-practice::
2517

26-
Define a functional test that at least checks if your application pages
27-
are successfully loading.
18+
機能テストを定義することは、結局のところあなたのアプリケーションのページが正常にロードにされるかどうかチェックすることです。
2819

29-
A functional test can be as easy as this:
20+
機能テストは以下の例のように簡単です:
3021

3122
.. code-block:: php
3223
@@ -51,28 +42,20 @@ A functional test can be as easy as this:
5142
);
5243
}
5344
54-
This code checks that all the given URLs load successfully, which means that
55-
their HTTP response status code is between ``200`` and ``299``. This may
56-
not look that useful, but given how little effort this took, it's worth
57-
having it in your application.
45+
このコードは全ての与えられたURLが正しくロードできることをチェックし、それは各HTTPレスポンスのステータスコードが ``200`` から ``299`` の間であることを意味します。
46+
これは有用に見えないかもしれませんが、かかる労力がいかに少ないかを考慮すると、あなたのアプリケーションで行う価値があります。
5847

59-
In computer software, this kind of test is called `smoke testing`_ and consists
60-
of *"preliminary testing to reveal simple failures severe enough to reject a
61-
prospective software release"*.
48+
コンピュータソフトウェアにおいて、この種のテストは `smoke testing`_ と呼ばれ、 *「将来のソフトウェアリリースを退けるほど深刻な、単純な失敗を発見にするための予備的なテスト」* で構成されます。
6249

63-
Hardcode URLs in a Functional Test
64-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
機能テスト内のハードコードされたURL
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6552

66-
Some of you may be asking why the previous functional test doesn't use the URL
67-
generator service:
53+
皆さんのうち一部の方は何故、上記の機能テストがURLジェネレータサービスを使用していないのかを尋ねるかもしれません:
6854

6955
.. best-practice::
56+
機能テストにおいては、URLジェネレータを使用する代わりに、URLのハードコードが使用されます。
7057

71-
Hardcode the URLs used in the functional tests instead of using the URL
72-
generator.
73-
74-
Consider the following functional test that uses the ``router`` service to
75-
generate the URL of the tested page:
58+
テストページのURLを生成するために ``router`` サービスを使用した、以下の機能テストについて考えてみましょう。
7659

7760
.. code-block:: php
7861
@@ -85,26 +68,20 @@ generate the URL of the tested page:
8568
// ...
8669
}
8770
88-
This will work, but it has one *huge* drawback. If a developer mistakenly
89-
changes the path of the ``blog_archives`` route, the test will still pass,
90-
but the original (old) URL won't work! This means that any bookmarks for
91-
that URL will be broken and you'll lose any search engine page ranking.
71+
これは動作するでしょうが、一つ大きな欠点があります。もし開発者が ``blog_archives`` ルートのパスを誤って変更した場合、テストは未だ成功しますが、元の(古い)URLは動作しなくなるでしょう!これは、そのURLに対する全てのブックマークが壊れ、あなたが全ての検索エンジンのページランキングを失うことを意味します。
72+
73+
JavaScriptの機能テスト
74+
~~~~~~~~~~~~~~~~~~~~~~
9275

93-
Testing JavaScript Functionality
94-
--------------------------------
76+
組み込みの機能テストクライアントは素晴らしいですが、それをあなたのページで、任意のJavaScriptの振る舞いをテストするために使用することはできません。もしあなたがこのテストを行う必要がある場合、PHPUnitの内部から、 `Mink`_ ライブラリを使用することを検討してください。
9577

96-
The built-in functional testing client is great, but it can't be used to
97-
test any JavaScript behavior on your pages. If you need to test this, consider
98-
using the `Mink`_ library from within PHPUnit.
78+
もちろん、もしもあなたが大規模なJavaScriptフロントエンドを使用している場合、純粋なJavaScriptベースのテストツールを検討すべきです。
9979

100-
Of course, if you have a heavy JavaScript frontend, you should consider using
101-
pure JavaScript-based testing tools.
80+
機能テストについてさらに学ぶ
81+
~~~~~~~~~~~~~~~~~~~~~~~~~~
10282

103-
Learn More about Functional Tests
104-
---------------------------------
83+
`Faker`_ と `Alice`_ ライブラリを使用して、あなたのテストフィクスチャのため実運用に近いデータを生成することを検討してください。
10584

106-
Consider using `Faker`_ and `Alice`_ libraries to generate real-looking data
107-
for your test fixtures.
10885

10986
.. _`Faker`: https://github.com/fzaninotto/Faker
11087
.. _`Alice`: https://github.com/nelmio/alice

0 commit comments

Comments
 (0)