반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리

CombinationFixture Tutorial - FitLibrary -

2013. 8. 22. 12:53 | Posted by 솔웅


반응형

CombinationFixture

CombinationFixture 는 values들에 대해 pair로 operation 하는 경우 사용됩니다. value들은 row와 컬럼에 명시되고 그 operation은 다른 모든 관계된 values들을 사용해 perform 됩니다.



Table Format

테이블의 첫번째 줄은 fixture class 이름이다. 두번째 줄은 empty cell 이고 그 다음에 해당 operation에 대한 두번째 파라미터로 쓰일 값이 오게 됩니다. 그 이후의 줄들에는 해당 operation에 대한 첫번째 파라미터로 사용될 값이 첫번째 cell 에 들어옵니다. 그 다음에 해당 operation의 expected value 가 옵니다.


!|CombinationFixtureTest|
|  |1 |2|3|
|6 |6 |3|2|
|12|12|6|4|




Fixture class

이 fixture class는 fitlibrary.CombinationFixture를 extend 합니다. 이 fixture에서는 두개의 값들 (row와 column) 그리고 return 값을 가지는 combine method를 정의해야 합니다.



Java Source Code


package info.fitnesse.fixturegallery;

import fitlibrary.CombinationFixture;

public class CombinationFixtureTest extends CombinationFixture{
    public int combine(int theFirst, int theSecond) {
        return theFirst / theSecond;
    }
}



.NET Source Code


using fitlibrary;

namespace info.fitnesse.fixturegallery {
    public class CombinationFixtureTest: CombinationFixture {
        public int combine(int theFirst, int theSecond) {
            return theFirst / theSecond;
        }
    }
}



Python Source Code


# PYTHON: info.fitnesse.fixturegallery.CombinationFixtureTest
from fitLib.CombinationFixture import CombinationFixture

class CombinationFixtureTest(CombinationFixture):
    _typeDict = {}

    # PY3K: combine(theFirst : int, theSecond : int) : int
    _typeDict["combine.types"] = [ "Int", "Int", "Int" ]
    def combine(self, theFirst, theSecond):
        return theFirst / theSecond



Usage

CombinationFixture는 정확히 두개의 argument를 가지고 계산하는 경우 사용될 수 있습니다.

반응형