Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
ashleyfrieze
@ashleyfrieze
E.g. OneAtATime, an object with a method you can call from any thread, but which only lets one thread at a time execute.
This is a wrapper for synchronized or somesuch, but makes you declare your concurrency pattern, not implement it.
Similarly, I will solve @mxk1235 's concurrency problem with a pattern I have used elsewhere, a mutable variable that you can only access in a thread safe way.
Gregory Haskins
@greghaskins
Okay, I think I understand a lot better now. Any prior art we should be looking at?
ashleyfrieze
@ashleyfrieze
Say ThreadSafeVariable with methods like set and map and change, where the inside of the box is synchronized and you pass in a function to gain thread safe access to the inside. Set is an exceptional case...
I don't know.
Gregory Haskins
@greghaskins
Yeah, I think I see where you’re going.
ashleyfrieze
@ashleyfrieze
I think one of the other Spectrum like runners does something in parallel. Ginkgo4j maybe?
The aim is to make this as lightweight as possible...
You could look at the multithreaded JUnit test library tempo (I think)...
Sorry. On vacation and on tablet... less ease for research.
Gregory Haskins
@greghaskins
No worries :smile: . For once it’s not me on the mobile device, hehe
ashleyfrieze
@ashleyfrieze
https://github.com/paulcwarren/ginkgo4j this supports parallel execution... I imagine it is not nice...
mxk1235
@mxk1235
thanks for looking into this guys. i ended up making my own Variable wrapper.
ashleyfrieze
@ashleyfrieze
The "this" is less your issue and more the unfinished parallelised test stuff I was planning to write anyway. Don't imagine you caused all this work single handed.:) I am glad the advice from earlier helped you. I hope you'll road test the new things when they are done. How are you finding Spectrum?
mxk1235
@mxk1235
of course not. ;) but so far your package has proved useful, and brings some nice readability to java tests
ashleyfrieze
@ashleyfrieze
Blame @greghaskins ... he is the master of making it read nicely with little surprise
ashleyfrieze
@ashleyfrieze
@greghaskins I am imagining an interface called Turnstile...
ashleyfrieze
@ashleyfrieze
https://github.com/ashleyfrieze/spectrum/commits/ParallelExecution <- the start of a long journey towards this feature set.
ashleyfrieze
@ashleyfrieze
ashleyfrieze
@ashleyfrieze
http://www.baeldung.com/java-weekly-186 the above blog was featured here... that's good exposure.
ashleyfrieze
@ashleyfrieze

Hi @greghaskins - thanks for your boom of activity over the weekend, it's energised me for a bit more Spectrum pushing.

I'm looking at returning to parallelising tests. I've updated the parallel Issue #61 accordingly. It would make my life easier if we could agree the timeout merge #119 before I proceeed, since I'll do better if I can use the latest versions of the Configuration stuff. We can always add Duration in after #119 if you prefer.

You'll see I've put a PR for my proxy idea - it was a 20 minute hack this morning to make it - but I'm not married to the idea. It just seems a good one. Similarly, I've also tried to put some concrete suggestions down for parameterised describe since the blog meantioned above seemed to be using the gherkin syntax as a workaround for the absence of something.

Finally, in the spirit of promoting the brand, I've updated JUnit's own wiki to show more BDD test runners - https://github.com/junit-team/junit4/wiki/Custom-runners - within which I've fairly honestly listed the entire family of RSpec/Jasmine-like test runners.

ashleyfrieze
@ashleyfrieze
So #119 now uses Duration because I decided you were right and I was wrong @greghaskins :)
Gregory Haskins
@greghaskins
@ashleyfrieze I’ve not been ignoring your PRs, in fact they've caused me to do some re-evaluation of Spectrum and it’s raison d’être. In a good way, as in expanding its scope and finally jumpstarting the org.spectrumbddsuite of libraries. I can’t chat now, but I plan to create an issue on the repo to discuss asynchronously.
ashleyfrieze
@ashleyfrieze

@greghaskins - I'm more posting things here to keep us both up to date, rather than as a cry for attention :) I'm interested to hear your plans. As always, I'll be hacking on the stuff that I think may be helpful. I've never quite managed to get this to fit the problem we originally set out to solve - mainly because of the lack of parallel - but I've got a workshop on it this week, which is why I have renewed energy for the subject.

Seeing the blog post on it made me remember why I got involved in this in the first place, and I'll try to do some more write ups of my own when we have new stuff to share with the world.

Gregory Haskins
@greghaskins
@ashleyfrieze my aplogies for the lack of brain-dumping in this space. Below is a tl;dr of my high-level thoughts:
  • The core Spectrum test runner does not and should not include any assertions (that’s a separate concern entirely). I would consider ExpectedException an assertion, since it would have to throw an AssertionError and explain why a failure occurred. If it’s anywhere, it would be in a separate assertion library.
Gregory Haskins
@greghaskins
  • Specifically on ExpectedException: I’m just not a fan of that style since it doesn’t let me pinpoint exactly where the execption gets thrown, and it puts the assertion before the method under test, where all my other assertions come after the method under test. Also,wWorking with testing newbies, I have found them really confused by that construct the first 5 times they see it. “There’s magic here, just trust it”. I like the AssertJ lambda style, even if it’s naming is a bit kludgy.
Gregory Haskins
@greghaskins
  • if we do make an expectations library, I have zero intention to use or re-implement Hamcrest matchers. I agree with you that they suck. My goal would be a lambda expression (predicate) as the minimum viable matcher, so long as there is a clear failure message.
  • On spectrumbdd/spectrum-expectations#2 my main point of discussion was to decide whether, if this library exists, it should use method composition or class inheritance for extensibility. Boiling it down: to write a new assertion/matcher, should I pass an object to the framework, or should I extend a class from the framework?
ashleyfrieze
@ashleyfrieze
Easy answer: composition and lambda, not inheritance. Spectrum is, and should be functional.
I'll drop the expected exception pr and issue.
I'll drop the expected exception or and issue
I also agree with why exception expectations are better via a wrapping assertion.
Manav Brar
@braghome
Hi anyone has ideas on how to workaround #125
ashleyfrieze
@ashleyfrieze
I assume you are doing mvn verify
Manav Brar
@braghome

I think it doesn’t matter

mvn clean verify -Dspectrum.tags.include=bethInvitaion -pl data-api
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building data-api 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ data-api ---
[INFO] Deleting /Users/mbrar/Documents/beaker/trulia-api/data-api/testruns
[INFO] 
[INFO] --- xtend-maven-plugin:2.12.0:compile (default) @ data-api ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ data-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ data-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- xtend-maven-plugin:2.12.0:testCompile (default) @ data-api ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ data-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ data-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/mbrar/Documents/beaker/trulia-api/data-api/testruns/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ data-api ---
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ data-api ---
[INFO] Building jar: /Users/mbrar/Documents/beaker/trulia-api/data-api/testruns/data-api-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-jar-plugin:2.6:test-jar (default) @ data-api ---
[INFO] Building jar: /Users/mbrar/Documents/beaker/trulia-api/data-api/testruns/data-api-0.0.1-SNAPSHOT-tests.jar
[INFO] 
[INFO] --- maven-failsafe-plugin:2.20:integration-test (default) @ data-api ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.trulia.api.data.typebdd.BethInvitationSpecs
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.719 s - in com.trulia.api.data.typebdd.BethInvitationSpecs
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

have same results for surefire Vs failsafe

do you want me to add that block on the bug?
ashleyfrieze
@ashleyfrieze
I need to see your test class please
Manav Brar
@braghome
ok my test has lot on bisiness logic. sorry for the delay I will create something simple for you to see
ashleyfrieze
@ashleyfrieze
Just delete the contents of your it clauses. I only want to see the way you are using the class, annotations and the calls to describe, it, etc
Manav Brar
@braghome
I have updated the bug
Manav Brar
@braghome
Also it would be helpful someone can list out some open source projects using Spectrum, which can be very helpful sometimes
ashleyfrieze
@ashleyfrieze
@braghome - did my example help?
@greghaskins - annoying to have to bugfix #126 ... my bad, I'm sure. Would you mind giving me feedback on #127 when you have a minute pls.
Gregory Haskins
@greghaskins
I’ll see what I can do. I’m completely swamped this week, though, so it might be a while.
ashleyfrieze
@ashleyfrieze

Appreciated. No pressure. If someone were affected by the bug, they can always borrow a private branch/build.

It may make life easier if I tackle the timeout should cover the whole of the test execution, including the befores issue next. That would potentially remove the need to release my bug fix on a branch.

I did #47 today because I wanted to experiment with the test runner executing tests in non sequential order to see how it would react to parallel tests, which will give their results in any old order. It seemed fine... that might be an easy merge for you too... or not. The requester liked it :)

Just throw ideas/effort my way when you have the time.
ashleyfrieze
@ashleyfrieze
Hi @greghaskins . Happy New Year. Will you have some time to look at merges in the next few weeks? Shall I prepare a guide to my open PRs to help prioritise?