[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to do test in Flink?

Hi Chang,

Just to add to how you could test the function you've posted. The Collector is an interface so you can just implement a stub that will keep the results in e.g. some java collection. Then you can assert this collection. The collector might look like this:

class ListCollector[T](list: java.util.List[T]) extends Collector[T] {

  override def collect(record: T): Unit = {

  override def close(): Unit = {



On 13/08/18 01:10, Chang Liu wrote:
Dear all,

I have some questions regarding testing in Flink. The more general question is: is there any guideline, template, or best practices that we can follow if we want to test our flink code (more in scala)?

I know there is this page: https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/stream/testing.html but not so much written there. And I also did not find a more comprehensive documentation of this library: flink-test-utils_2.11.

One detailed question: how do you test this WindowFunction below? The return type is Unit right? We cannot do unit test on like, like how the ReduceFunction was tested in the example link above. Then we only have the option of doing integration testing on it?

Your ideas would be very helpful :) Thanks in advance !

Best regards/祝好,

Chang Liu 刘畅

Attachment: signature.asc
Description: OpenPGP digital signature