question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please add test cases for the sake of helping users of the library

See original GitHub issue

Test caseio.finch.iteratee.EnumerateEndpointSpec does not contain any useful test case from the users’ perspective.

I’m trying to do something as simple as:

package com.example.helloworld

import cats.effect.IO
import com.twitter.finagle.Http
import com.twitter.util.Await
import io.iteratee.{Enumerator, Iteratee}
import io.finch._
import io.finch.circe._
import io.finch.iteratee._
import io.finch.catsEffect._

object Main extends App {

  def concat: Endpoint[IO, String] = post("concat" :: enumeratorBody[IO, String, Text.Plain]) {
    enum: Enumerator[IO, String] =>
      enum.into(Iteratee.fold[IO, String, String]("")(_ + _)).map(Ok)
  }

  Await.ready(
    Http.server
      .serve(":8081", (concat).toServiceAs[Text.Plain])
  )
}

with a deadly simple test case as

package com.example.helloworld

import org.scalatest.FunSuite

class MainTest extends FunSuite {
  test("helloWorld") {
    import io.finch._
    val body: String =
      """{"i":"aaaaa"}
        |{"i":"bbbbb"}
      """.stripMargin
    assert(
      Main.concat(
        Input
          .post("/concat")
          .withBody[Text.Plain](body)).awaitValueUnsafe() == Some("aaaaabbbbb"))
  }
}

and it does not work. So, it’s clear that I’m doing something wrong… but what?

Looking for test cases, there’s nothing which could provide any clue why things are going wrong.

So, please add test cases not only when things go wrong, but also showing what needs to be done in order to obtain positive results.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
vkostyukovcommented, Nov 15, 2018

@frgomes

  • I filed #1040 which would ensure your server code compile (as written).
  • There is #1038 that should help with testing it (would require some code changes in your test as the payload has to be chunked).
  • Finally in #1018 we can add a g8 template that wires everything together
0reactions
vkostyukovcommented, Jan 10, 2019

I think we can close this. The upcoming 0.27 release has all the missing pieces outlined by this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

180+ Web Application Testing Example Test Cases (Sample ...
Using this checklist, you can easily create hundreds of Test cases for testing web or desktop applications. These are all general test cases...
Read more >
Unit Testing Best Practices: 9 to Ensure You Do It Right
Do you know any unit testing best practice? In this post, you'll learn nine of them so you can get started the right...
Read more >
Writing Automated Tests for Accessibility - Deque Systems
In this post, we'll highlight the strengths and weaknesses of automated testing for web accessibility to both add value to your workflow and ......
Read more >
Software Testing: 101 Top Tips, Tricks and Strategies - Stackify
Software testing is a collection of tests to determine if a software app works and will continue working. Get tips and tricks from...
Read more >
The Best Test Case Management Tool for Jira
If you need some help your evaluation of test case management tools for Jira we'd be happy to ... Or when creating your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found