0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

    `TDD(テスト駆動開発)`
  • 1.最初にテストを書く

  • 2.テストをパスする様に最小限のコードを書く

  • 3.リファクタリング

  • 4.1に戻る(テストを書く)

  • TDDはテストファースト(テストをパスするためだけに書く)
    **expect(sum(1,1)).to.equal(2);**
    の場合
    function sum(a,b) { return 2; }

expect(sum(1,1)).to.equal(2);
expect(sum(1,2)).to.equal(3);

`function sum(a,b) {
if(a == 1 && b == 1) {
return 2;
}

if(a == 1 && b == 2) {
return 3
}
}`

共通化できるコードは?
function sum(a,b) { return a+b; }

    `BDD(振る舞い駆動開発)`
  • BDDはテストの書き方のスタイル

      `🟢describeでAスイートというテストグループを作る
      describe("A suite,function() {
      🟢ここに複数のテストを書く
      });
      🟢itは求められるspecで、1つのテスト
      it("contains spec with an expectation",
      🟢It should contain spec with an expection(それは期待を含むべきである)を省略
      function 
      () {
      🟢一つのテストを行う
      });
      🟢こうなるはずという期待
      expect(true).to.be.true;
      🟢trueがtrueである事を期待する
      expect(true).to.not.be.false;
      🟢trueがfalseでない事を期待する
      });
      });`
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?