juan_gandhi: (VP)
[personal profile] juan_gandhi
Looking in the direction of frp, I'm afraid.

See, you have, say, a test. The sut you are testing has some component injected, e.g.

val sut = new FileUploader {
override def userAgent = behaveDifferentlyOnDifferentOccasions
}

def behaveDifferentlyOnDifferentOccasions = ???


and you sure want to make this behaveDifferentlyOnDifferentOccasions depend on test cases, right? So, what options do you have?
- Introduce a variable, which you change? The thing is, Scala tests use to run in parallel unless told otherwise. -- Make sut a function?

Just asking. A good answer may be kind of disruptive, as they say here in the Bay Area.

Date: 2014-05-02 05:42 pm (UTC)
From: [identity profile] justy-tylor.livejournal.com
Можно нарисовать монаду вокруг ThreadLocal, и с её помощью устанавливать все контексты для тестов.

Date: 2014-05-02 05:43 pm (UTC)
From: [identity profile] ivan-gandhi.livejournal.com
Да, тоже решение, конечно.

Date: 2014-05-03 02:07 am (UTC)
From: [identity profile] smalgin.livejournal.com
Никакого решения, кроме контекстов, в дикой пртроде пока не видел. Грубо говоря, везде одно и то же - функция, event или монада для умных, в которую передают ключ. Это может быть threadId, либо идентификатор mock client Id, либо оба.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

July 2025

S M T W T F S
  12345
6789 1011 12
131415 1617 1819
20212223242526
2728293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 23rd, 2025 04:19 pm
Powered by Dreamwidth Studios