날짜/시간 참조를 사용한 테스트 흐름
반복 가능한 테스트를 실행하려면 DataStage, 동일한 입력에 대해 데이터 흐름이 항상 동일한 결과를 생성해야 합니다. 그러나 계산에 현재 날짜나 시간을 사용하면 작업 실행 시점에 따라 결과가 달라질 수 있습니다. 현재 날짜를 사용하는 작업을 설계할 때에도 신뢰할 수 있는 테스트를 수행할 수 있도록 할 수 있습니다.
시스템 시간 및 날짜 기능을 사용하는 변압기 단계
변압기 단계에서, CurrentTime() 또는 CurrentTimestamp()CurrentDate() 함수를 사용하는 분기 회로는 테스트 설계 시 신중하게 고려해야 합니다. 계산에 특정 날짜 및/또는 시간이 필요하지 않은 경우, 다음 함수: CurrentDate(), CurrentTime(), 및 CurrentTimestamp() 를 DSJobStartDate, DSJobStartTime 및 DSJobStartTimestamp 매크로 호출로 대체하는 것을 고려하십시오.
테스트 사양 when 노드의 절에, DSJobStartTime, 및 DSJobStartTimestamp ( DSJobStartDateparameters 필요한 경우)를 추가하고 단위 테스트 중에 사용되는 적절한 날짜 및 시간 값을 설정하십시오.
다음 표현식을 사용하는 두 개의 Transformer 단계 변수 예시를 참조하십시오:
BeforeToday =
If inPurchases.Purchase_Date < DSJobStartDate Then "Yes" else "No"
EarlierToday =
If inPurchases.Purchase_Date = DSJobStartDate and
inPurchases.Purchase_Time < DSJobStartTime Then "Yes" else "No"이 경우, 테스트 사양서의 해당 when 섹션은 다음과 같습니다:{
"given": [
...
],
"when": {
"data_intg_flow_ref": "example_flow_data_intg",
"parameters": {
"DSJobStartDate": "2012-01-15",
"DSJobStartTime": "11:05:01"
}
},
"then": [
...
]
}참고: 여러 날짜/시간 매크로를 사용할 때는 주의하십시오.
Exercise caution when setting `DSJobStartTimestamp` in conjunction with either `DSJobStartDate` or `DSJobStartTime` as the DataStage test case capability does not attempt to enforce logical consistency between these parameters. i.e. You could specify conflicting values for these macros which would create a contradictory logical condition. e.g.
```json
{
"when": {
"data_intg_flow_ref": "blah-blah-blah",
"parameters": {
"DSJobStartTimestamp": "2025-02-03 00:00:00",
"DSJobStartDate": "2024-04-05"
"DSJobStartTime": "09:30:00"
}
}
}
```