테스트 시나리오 작성
엔티티 및 이벤트에 테스트를 실행하여 솔루션이 예상대로 작동하는지 확인할 수 있습니다. 테스트 시나리오에서는 엔티티를 로드하고 단일 파일에서 이벤트를 제출한 후 엔티티 값, 엔티티 속성 및 사용자 서버의 이벤트를 확인하는 테스트를 작성할 수 있습니다.
시작하기 전에
이 태스크 정보
시나리오를 작성하고 각 생성은 세미콜론(;)으로 끝나야 합니다. 테스트 결과는 사용자가 이러한 결과를 사용자의 예상과 비교할 수 있도록 콘솔 탭에서 표시합니다.
프로시저
예
다음 예제에서는 두 엔티티 로더(customer_ids 및 items)의 엔티티가 로드되고 두 이벤트 순서(purchases 및 returns)의 이벤트가 서버에 제출됩니다. 그 다음에는 테스트가 엔티티 Betty의 속성을 확인합니다. 이 테스트는 Betty의 이름, 직업 및 주소를 확인합니다.
load entities from:
- "customer_ids"
- "items" ;
submit events from :
- "purchases"
- "returns" ;
check that for the customer "Betty" :
- the name of this customer is "Betty"
- the occupation of this customer is not "Software Architect"
- the address of this customer is not null
- the occupation of this customer is not null ;
다음 예제는 숫자 연산자를 사용하여 고객의 나이가 특정 범위 내에 포함되는지 확인합니다.
check that for the customer "Betty" :
- the age of this customer is between 18 and 65
- the age of this customer is more than 21
- the age of this customer is at most 50 ;
다음 예제에서 트랜잭션 세트를 작성한 후 고객은 GOLD 상태입니다. 시간이 경과하면서 발생하는 내용을 확인하기 위해, 세 번의 테스트에서 간헐적 기간 이후의 David 상태를 확인합니다. continue processing until <date> 생성은 이벤트 순서의 마지막 시간소인부터 지정된 <date>까지의 시간 경과를 시뮬레이션하고, 이 기간 동안 이벤트가 스케줄링될 수 있습니다. 이 예제에서는 David에게 다른 트랜잭션 이벤트가 스케줄되어 있지 않습니다. 테스트는 상태가 08/24/15 당시 SILVER인지 확인하고, 다른 테스트는 상태가 변경되었는지 확인하며, 세 번째 테스트는 상태가 02/24/16 당시 BRONZE인지를 확인합니다. 이벤트 순서 이벤트의 마지막 시간소인 이후 08/24/15까지 그리고 02/24/16까지 시간이 경과하면서, David의 상태는 결과로서 GOLD에서 SILVER로, 그리고는 BRONZE로 변경되었습니다. 시간이 지남에 따라 David가 새 트랜잭션을 작성하지 않으므로 고객 상태는 낮아집니다.
submit events from "transactions until gold" ;
check that for the customer "David":
- the status of this customer is GOLD ;
continue processing until 08/24/16 ;
check that for the customer "David" :
- the status of this customer is SILVER ;
check that for the status change in the events emitted
by "CustomerLoyaltyAgent" :
- the customer id of the customer of this status change is "David"
- the new status of this status change is SILVER ;
continue processing until 02/24/17 ;
check that for the customer "David" :
- the status of this customer is BRONZE ;