Github user pnowojski commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4454#discussion_r131900306
  
    --- Diff: docs/dev/testing.md ---
    @@ -0,0 +1,189 @@
    +---
    +title: "Testing"
    +nav-parent_id: dev
    +nav-id: testing
    +nav-pos: 99
    +---
    +<!--
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright ownership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +
    +  http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +-->
    +
    +This page briefly discusses how to test Flink application in the local 
environment.
    +
    +* This will be replaced by the TOC
    +{:toc}
    +
    +## Unit testing
    +
    +It is encouraged to test your classes with unit tests as much as possible. 
For example if one implement following `ReduceFunction`:
    +
    +~~~java
    +public class SumReduce implements ReduceFunction<Long> {
    +    @Override
    +    public Long reduce(Long value1, Long value2) throws Exception {
    +        return value1 + value2;
    +    }
    +}
    +~~~
    +
    +it is very easy to unit test it with your favorite framework:
    +
    +~~~java
    +public class SumReduceTest {
    +    @Test
    +    public void testSum() throws Exception {
    +        SumReduce sumReduce = new SumReduce();
    +
    +        assertEquals(42L, sumReduce.reduce(40L, 2L));
    +    }
    +}
    +~~~
    +
    +Or in scala:
    +
    +~~~scala
    +class SumReduce extends ReduceFunction[Long] {
    +    override def reduce(value1: java.lang.Long,
    +                        value2: java.lang.Long): java.lang.Long = value1 + 
value2
    +}
    +~~~
    +
    +~~~scala
    +class SumReduceTest extends FlatSpec with Matchers {
    +    "SumReduce" should "add values" in {
    +        val sumReduce: SumReduce = new SumReduce()
    +        sumReduce.reduce(40L, 2L) should be (42L)
    +    }
    +}
    +~~~
    +
    +## Integration testing
    +
    +You also can write integration tests that are executed against local Flink 
mini cluster.
    +In order to do so add a test dependency `flink-test-utils`.
    +
    +~~~ xml
    +<dependency>
    +  <groupId>org.apache.flink</groupId>
    +  <artifactId>flink-test-utils{{site.scala_version_suffix}}</artifactId>
    +  <version>{{site.version}}</version>
    +</dependency>
    +~~~
    --- End diff --
    
    Updated but it properties names depends on the user's `pom.xml` file.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to