ldnclj

Find us on #clojure-uk
thomas 2016-02-01T09:01:42.000162Z

morning

glenjamin 2016-02-01T09:14:56.000163Z

Morning, anyone know of a good example of using property-based testing for validation?

glenjamin 2016-02-01T09:16:35.000164Z

Say I have a text field that's 1-50 alphanumeric chars, asserting the positive is simple enough - but what properties would you apply for failure cases?

glenjamin 2016-02-01T09:17:41.000165Z

Or do I just generate strings and have an if statement in the property?

2016-02-01T10:19:50.000166Z

morning

2016-02-01T10:23:40.000167Z

@glenjamin: good question. My current (limited) understanding of property based testing is exactly that. Have a property like ‘allows only valid inputs’ and throws strings from 0 - 5000 character strings at it. the property passes if the string was valid and the system allows access, or if an invalid string results in matching error message?

2016-02-01T10:24:06.000168Z

@glenjamin: have you done my property based testing?

glenjamin 2016-02-01T10:25:08.000169Z

i’ve used it a bit, mostly to try and do this type of testing

glenjamin 2016-02-01T10:26:20.000170Z

the problem is how best to know whether a string is valid or not, since that’s exactly what i’m testing

2016-02-01T10:28:58.000171Z

should the story / requirements not specify what should and shouldn’t be valid rather than the system under test?

glenjamin 2016-02-01T10:33:37.000172Z

yup, the bit i’m struggling with is how to express those in a property-based system

2016-02-01T10:35:36.000173Z

I’m insufficiently experienced to offer advice about it, having only read and played this weekend. I did have a v. useful conversation in #C08LK2DH7 about it, and received excellent advise. I would be keen to follow your endeavours, and assist where I can.

agile_geek 2016-02-01T10:47:58.000174Z

We all seem to be struggling with how to turn a spec into property based testing assertions.

agile_geek 2016-02-01T10:49:45.000175Z

My personal experiments around this 5-6 months ago led me to deduce it was much harder to write the code to generate and verify the test properties than the code to implement the solution. This was probably because it was too trivial a problem.

agile_geek 2016-02-01T10:50:38.000176Z

I ended up testing invariants like inverting the inputs and outputs with property based testing and the rest of the tests as normal example based.

agile_geek 2016-02-01T10:52:15.000177Z

My problem was a 'cheque parser' i.e. a number to words convertor that takes a number and expresses it in english words. e.g 120456 = "one hundred and twenty thousand, four hundred and fifty six"

agile_geek 2016-02-01T10:53:52.000178Z

I found property based testing unhelpful here and what few tests I wrote took me much longer than the implementation and were so complex I wanted tests around them to prove the property tests were correct!

agile_geek 2016-02-01T10:54:38.000179Z

We should start a virtual property based testing self help group 😉

glenjamin 2016-02-01T11:02:10.000180Z

part of my problem (i think), is that validation rules combine via intersection

glenjamin 2016-02-01T11:02:19.000181Z

but the inverse combines via union

glenjamin 2016-02-01T11:03:00.000182Z

so if my rules are 1-20 chars, alphanum. my inverse properties are <1, >20, non-alphanum

agile_geek 2016-02-01T11:29:32.000183Z

@glenjamin: hadn't thought of that but nice deduction. I think that's true of a lot of problems, if not all?

annapawlicka 2016-02-01T21:17:03.000184Z

@maleghast: the company that I work for is hiring and they do offer H1B: https://news.ycombinator.com/item?id=11012931

thomas 2016-02-01T21:45:32.000185Z

@annapawlicka: what is it like working for W?

thomas 2016-02-01T21:45:35.000186Z

any good?

annapawlicka 2016-02-01T21:46:49.000187Z

Yup. Good team and interesting problems to solve.

thomas 2016-02-01T21:47:22.000188Z

and how is life out there?

annapawlicka 2016-02-01T21:47:52.000189Z

more laid back than in London :simple_smile:

thomas 2016-02-01T21:48:35.000190Z

:simple_smile:

thomas 2016-02-01T21:48:49.000191Z

must be all those hippies in SF 😉

annapawlicka 2016-02-01T21:49:25.000192Z

haha very likely

thomas 2016-02-01T21:51:47.000193Z

but good to hear that you are enjoying yourself!!! and also great of you to drop in on lndclj!

annapawlicka 2016-02-01T21:52:51.000194Z

I never left lndclj :simple_smile: the problem is the time difference. Everyone is asleep when I’m online

thomas 2016-02-01T21:57:07.000195Z

:simple_smile: