Book Image

Programming Kotlin

Book Image

Programming Kotlin

Overview of this book

Quickly learn the fundamentals of the Kotlin language and see it in action on the web. Easy to follow and covering the full set of programming features, this book will get you fluent in Kotlin for Android.
Table of Contents (20 chapters)
Programming Kotlin
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Getting started


Writing your first test with KotlinTest is very straightforward. Firstly, the KotlinTest dependency will need to be added to your build. The easiest way to do this if you are using Gradle or Maven is to search Maven central for io.kotlintest- just visit http://search.maven.org and grab the latest version. You will need to add this to your Gradle build using the following:

    testCompile 'io.kotlintest:kotlintest:2.0.0'

Alternatively, for Maven, use the following code:

    <dependency>
      <groupId>io.kotlintest</groupId>
      <artifactId>kotlintest</artifactId>
      <version>2.0.0</version>
      <scope>test</scope>
    </dependency>

Next, create the test source folder, usually src/test/kotlin, if it doesn't exist already. We are going to write a unit test for the standard library String class. So create a file called StringTest.kt. Inside this file, create a single class called StringTest...