[ 
https://issues.apache.org/jira/browse/FLINK-7554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16413526#comment-16413526
 ] 

Timo Walther commented on FLINK-7554:
-------------------------------------

This issue is about adding utilities for unit testing of Flink functions. For 
example, for a UDF like [EnrichmentFunction 
|https://github.com/dataArtisans/flink-training-exercises/blob/master/src/main/java/com/dataartisans/flinktraining/exercises/datastream_java/process/JoinRidesWithFares.java]
 we could use a testing RuntimeContext like:

{code}
// function to test
EnrichmentFunction func = new EnrichmentFunction();
// create context
TestingRuntimeContext testContext = new TestingRuntimeContext();
func.setRuntimeContext(testContext);
// do processing
func.processElement(...);
func.processElement(...);
// validate
Assert.equals(List(...), testContext.getValueStates())
{code}

> Add a testing RuntimeContext to test utilities
> ----------------------------------------------
>
>                 Key: FLINK-7554
>                 URL: https://issues.apache.org/jira/browse/FLINK-7554
>             Project: Flink
>          Issue Type: New Feature
>          Components: Tests
>            Reporter: Timo Walther
>            Priority: Major
>              Labels: starter
>
> When unit testing user-defined functions it would be useful to have an 
> official testing {{RuntimeContext}} that uses Java collections for storing 
> state, metrics, etc.
> After executing the business logic, the user could then verify how the state 
> of the UDF changed or which metrics have been collected.
> This issue includes documentation for the "Testing" section.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to