2010年8月9日月曜日

Google C++ Testing Frameworkで述べられているプライベートメンバー関数のテストについて

参考ページ

原文:
If you change your software's internal implementation, your tests should not break as long as the change is not observable by users. Therefore, per the black-box testing principle, most of the time you should test your code through its public interfaces.

If you still find yourself needing to test internal implementation code, consider if there's a better design that wouldn't require you to do so.....

訳:
 あなたがソフトウェアの内部の実装を変更したいとして、ユーザに分からないような変更に時間をかけるべきではない。あなたは、他のクラスとのインターフェースとなる関数のテストに時間をかけるべきだ。
 もし、まだ内部の実装をテストしたいなら、その必要が無いようなデザインをもっと考えたほうがいい。

個人的な意見:
 そうは言っても、Composedパターンなどで多数のプライベート関数が生まれることは避けられないのだから、プライベート関数をテストすることは、必要なのではないの?

1 件のコメント:

  1. The very root of your writing whilst appearing reasonable in the beginning,
    did not work perfectly with me after some time.
    Someplace within the paragraphs you managed to make me a believer but only for a short while.
    I nevertheless have a problem with your leaps in assumptions and one would do well to fill in those breaks.

    In the event that you actually can accomplish that, I will certainly end up being fascinated.


    Also visit my web-site; shox nz

    返信削除