Re: regarding writing unit tests in clojure for existing java code

2017-05-29 Thread manas . marthi
e >> code base changes and quite a number are outdated. >> I was wondering if I can use clojure to write unit tests and run them >> using Junit Runner so that the unit tests pass inside eclipse as part of >> compilation of Junit test suite execution. >>

Re: regarding writing unit tests in clojure for existing java code

2017-05-28 Thread Daniel Compton
2017 at 9:46 AM wrote: > Hello All,. > > We have a large java code base. Junits are not keeping in pace with the > code base changes and quite a number are outdated. > I was wondering if I can use clojure to write unit tests and run them > using Junit Runner so that the un

regarding writing unit tests in clojure for existing java code

2017-05-26 Thread manas . marthi
Hello All,. We have a large java code base. Junits are not keeping in pace with the code base changes and quite a number are outdated. I was wondering if I can use clojure to write unit tests and run them using Junit Runner so that the unit tests pass inside eclipse as part of compilation

unit tests on gen-class outcome

2016-12-20 Thread Jacek Grzebyta
Hi, I have a project which uses some java project. I made classes using gen-class. Than in unit test just wanted to test it (clojure.test enviro). If I run tests in emacs+cider they works. If I run test in the command line I have class not found exception: boot testing aot run-test task testing

Re: is there a way to use drip to speed up the running of unit tests?

2016-06-26 Thread Daniel Compton
essage. >> >> If you’re using expectations <https://github.com/jaycfields/expectations> >> then there is also lein-autoexpect >> <https://github.com/jakemcc/lein-autoexpect> for running your tests on >> code change. Midje and speclj have their own autotest runne

Re: is there a way to use drip to speed up the running of unit tests?

2016-06-26 Thread Alan Thompson
une 23, 2016 at 4:13:34 PM UTC-5, Fenton Travers wrote: > > is there a way to use drip to speed up the running of unit tests? >> >> I'm not sure if there is way to use drip to speed up the launching and >> running of tests, but that would be great if there was. >> >

Re: is there a way to use drip to speed up the running of unit tests?

2016-06-25 Thread Jake McCrary
ur tests on code change. Midje and speclj have their own autotest runners. On Thursday, June 23, 2016 at 4:13:34 PM UTC-5, Fenton Travers wrote: is there a way to use drip to speed up the running of unit tests? > > I'm not sure if there is way to use drip to speed up the launching an

is there a way to use drip to speed up the running of unit tests?

2016-06-23 Thread Fenton Travers
is there a way to use drip to speed up the running of unit tests? I'm not sure if there is way to use drip to speed up the launching and running of tests, but that would be great if there was. -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: Add a function annotation for scoping in unit tests

2016-03-23 Thread sundbry
Thanks Alex, that's very helpful. -- Ryan On Wednesday, March 23, 2016 at 5:02:43 AM UTC-7, Alex Miller wrote: > > I guess the other important detail there is that when you invoke a var > holding a function, it invokes the function. > > On Wednesday, March 23, 2016 at 7:01:41 AM UTC-5, Alex Mill

Re: Add a function annotation for scoping in unit tests

2016-03-23 Thread Alex Miller
I guess the other important detail there is that when you invoke a var holding a function, it invokes the function. On Wednesday, March 23, 2016 at 7:01:41 AM UTC-5, Alex Miller wrote: > > Private functions (really vars marked private holding a function) can > always be accessed via the var #' s

Re: Add a function annotation for scoping in unit tests

2016-03-23 Thread Alex Miller
Private functions (really vars marked private holding a function) can always be accessed via the var #' syntax: (ns banana-test ...) (deftest ring-ring [] (is (sting? (#'banana/phone))) This is the way private functions are typically tested. On Wednesday, March 23, 2016 at 6:53:12 AM UT

Add a function annotation for scoping in unit tests

2016-03-23 Thread sundbry
Hi everyone, What are your opinions on adding a special metadata to functions to provide it in scope for tests? This would be a nice language feature to have: For example, (ns banana) (defn- ^:+test phone [] "ring ring ring") (ns banana-test ...) (deftest ring-ring [] ; We can call the

Re: [ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread Atamert Ölçgen
Got it. Thanks! On Mon, Jun 8, 2015 at 6:14 PM, David Sargeant wrote: > I'm not totally sure why you would need to use `provided` with pure > functions, but that is definitely not in scope for this project. example > isn't meant to replace all cases where you would write tests. It's designed > t

Re: [ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread David Sargeant
I'm not totally sure why you would need to use `provided` with pure functions, but that is definitely not in scope for this project. example isn't meant to replace all cases where you would write tests. It's designed to streamline the creation of a certain class of tests that come with a lot of

Re: [ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread Atamert Ölçgen
I meant (provided), (against-background), etc. On Mon, Jun 8, 2015 at 6:02 PM, David Sargeant wrote: > If I need something more complicated in terms of testing my functions I > usually create a file dev/examples.clj and add dev to the source-paths in > my project's dev profile. I would require t

Re: [ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread David Sargeant
If I need something more complicated in terms of testing my functions I usually create a file dev/examples.clj and add dev to the source-paths in my project's dev profile. I would require the namespace with my functions and put the examples in dev/examples.clj. The rest of the process is the s

Re: [ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread Atamert Ölçgen
ons. > 2. Test the output of your functions in the REPL as you code. > 3. Generate unit tests when you're satisfied with the behavior of your > functions. > > See https://github.com/dubiousdavid/example for more information. > > -- > You received this message becaus

[ANN] - example : Stop writing unit tests and generate them instead (details inside)

2015-06-08 Thread David Sargeant
Speed up your development cycle using example. Here's the process: 1. Write your test code inline with your functions. 2. Test the output of your functions in the REPL as you code. 3. Generate unit tests when you're satisfied with the behavior of your functions. See https://

Re: Mock db data for unit tests

2014-03-07 Thread Alex Robbins
ith my db. To mock > data for unit tests I want to re-bind korma.core/select to return known > data and not hit a db. > > Currently I have a db ns: > > (nsservices.db > (:require [korma.core :refer :all] >[korma.db :refer :all])) > > > With a function

Mock db data for unit tests

2014-03-07 Thread Mark Watson
I have a web service that uses Korma for interacting with my db. To mock data for unit tests I want to re-bind korma.core/select to return known data and not hit a db. Currently I have a db ns: (nsservices.db (:require [korma.core :refer :all] [korma.db :refer :all])) With a

Re: Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-26 Thread Chris Zheng
Thanks Matt! Yes it does! Please give it a go. I would love to see some examples of more generated readmes On 27/09/2013, at 1:39, Matt Mitchell wrote: > Very nice! Does lein-midje-doc use the Midje fact(s) labels? > > - Matt > > On Wednesday, September 25, 2013 10:33:31 PM UTC-4, zcaudate

Re: Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-26 Thread Chris Zheng
Hi Ben! Thanks for the feedback! I have thought about how this feature may be implemented. I've got some ideas but a little short on time... With what you are saying, The autodoc feature has to be built into the library as well. To generate an index of functions, one can use a tag of some kind.

Re: Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-26 Thread Ben Mabey
On 9/25/13 8:33 PM, zcaudate wrote: I've put up a video of a new documentation plugin for leiningen Project Page: https://github.com/zcaudate/lein-midje-doc Youtube Video: http://www.youtube.com/watch?v=8FjvhDPIUWE&feature=youtu.be Sample Generated Documentation: http://z.caudate.me/lein-midj

Re: Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-26 Thread Matt Mitchell
Very nice! Does lein-midje-doc use the Midje fact(s) labels? - Matt On Wednesday, September 25, 2013 10:33:31 PM UTC-4, zcaudate wrote: > > I've put up a video of a new documentation plugin for leiningen > > Project Page: > https://github.com/zcaudate/lein-midje-doc > > Youtube Video: > http://ww

Video: Generating Beautiful (and Correct) Documentation from Unit Tests Files

2013-09-25 Thread zcaudate
I've put up a video of a new documentation plugin for leiningen Project Page: https://github.com/zcaudate/lein-midje-doc Youtube Video: http://www.youtube.com/watch?v=8FjvhDPIUWE&feature=youtu.be Sample Generated Documentation: http://z.caudate.me/lein-midje-doc/ http://z.caudate.me/ribol/ http

Re: Automatically unmapping unit tests from namespaces

2010-12-22 Thread Phil Hagelberg
On Dec 22, 8:54 am, Constantine Vetoshev wrote: > clojure-test-mode is pretty nice, but is there any way to make its > test namespace naming convention configurable? > > It currently expects src/com/company/project/file.clj to correspond to > test/com/company/project/test/file.clj. I prefer test/t

Re: Automatically unmapping unit tests from namespaces

2010-12-22 Thread Constantine Vetoshev
On Dec 21, 7:16 pm, Phil Hagelberg wrote: > If you're already using swank then you can try clojure-test-mode; it > clears out all deftests in between test runs. > > https://github.com/technomancy/clojure-mode/blob/master/clojure-test-... > > It also highlights failures in the test buffer for bette

Re: Automatically unmapping unit tests from namespaces

2010-12-22 Thread gaz jones
you can also move to the failed test and press C-c ' and it will show them in the mini-buffer On Tue, Dec 21, 2010 at 11:47 PM, Michael Ossareh wrote: > > > On Tue, Dec 21, 2010 at 21:36, Michael Ossareh wrote: >> >> On Tue, Dec 21, 2010 at 16:16, Phil Hagelberg wrote: >>> >>> It also highlight

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Michael Ossareh
On Tue, Dec 21, 2010 at 21:36, Michael Ossareh wrote: > On Tue, Dec 21, 2010 at 16:16, Phil Hagelberg wrote: >> >> >> It also highlights failures in the test buffer for better feedback. > > > when there is a failure where are the details of the failure printed out > to? I love that the highlight

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Michael Ossareh
On Tue, Dec 21, 2010 at 16:16, Phil Hagelberg wrote: > > > It also highlights failures in the test buffer for better feedback. when there is a failure where are the details of the failure printed out to? I love that the highlight shows me which test have errors, but since I've moved over to the

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
Awesome!!! This absolutely does the trick! On Dec 21, 7:16 pm, Phil Hagelberg wrote: > On Dec 21, 10:35 am, Alyssa Kwan wrote: > > > What about when I need to delete a unit test?  Reloading the test > > buffer doesn't remove it, and I need to either restart swank or > > reconnect slime, or manu

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Phil Hagelberg
On Dec 21, 10:35 am, Alyssa Kwan wrote: > What about when I need to delete a unit test?  Reloading the test > buffer doesn't remove it, and I need to either restart swank or > reconnect slime, or manually remove those tests using (unmap-ns). > Surely there's a better way... If you're already usin

Re: Automatically unmapping unit tests from namespaces

2010-12-21 Thread Stuart Sierra
You can delete the entire test namespace with `remove-ns` and then do `(require ... :reload)`. Or try Lazytest. :) -Stuart Sierra -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note tha

Automatically unmapping unit tests from namespaces

2010-12-21 Thread Alyssa Kwan
Hi everyone, My typical development workflow is to use leiningen to create a project stub, modify project.clj to add swank-clojure as a dev- dependency, and run lein-swank and connect from Emacs slime. As I create and modify files in the test and src namespaces/directory structures, I use C-c C-k

Re: defrecord issue in unit tests

2010-08-31 Thread garf
--Doh! Thanks, David, that worked On Aug 30, 8:29 am, David Nolen wrote: > On Mon, Aug 30, 2010 at 6:37 AM, garf wrote: > > I am getting the following error when I switched from defstruct to > > defrecord > > **Unable to resolve classname: Rule-record (RecordInitTest.clj:8)** > > I only have thi

Re: defrecord issue in unit tests

2010-08-30 Thread David Nolen
On Mon, Aug 30, 2010 at 6:37 AM, garf wrote: > I am getting the following error when I switched from defstruct to > defrecord > **Unable to resolve classname: Rule-record (RecordInitTest.clj:8)** > I only have this problem when definition & usage is split between two > files, i.e. defrecord cre

defrecord issue in unit tests

2010-08-30 Thread garf
Rule-record [ rname rule-seq ]) and second file that gives the error above when using unit tests (ns RecordInitTest) (use 'clojure.test) (use 'RecordInitQuest) (deftest ruleform-def-test (def rule1 (Rule-record. "rule-name" "more text"))) --if I

Re: peeking at private vars in unit tests

2009-12-14 Thread Rich Hickey
On Mon, Dec 14, 2009 at 8:18 AM, Stuart Halloway wrote: >> I see now that the simpler expression: >> >>       #'clojure.core/spread >> >> equivalent to >> >>       (var clojure.core/spread) >> >> also works: >> >>       user=> (#'clojure.core/spread [:a [:b :c]]) >>       (:a :b :c) > > This works

Re: peeking at private vars in unit tests

2009-12-14 Thread Meikel Brandmeyer
Hi, Am 14.12.2009 um 07:16 schrieb Chouser: > I'd like a ruling on this as well. It solves a real problem of > macros getting access to helper functions, so if we shouldn't be > relying on it, a reliable solution would be desirable. > > This technique is actually used in the "new" branch in > c

Re: peeking at private vars in unit tests

2009-12-14 Thread Rich Hickey
On Mon, Dec 14, 2009 at 1:16 AM, Chouser wrote: > On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi wrote: >> >> On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: >> >>> That's great. I wouldn't have expected it to work. Do you think this is by >>> design or coincidental/subject to change? >

Re: peeking at private vars in unit tests

2009-12-14 Thread Stuart Halloway
> I see now that the simpler expression: > > #'clojure.core/spread > > equivalent to > > (var clojure.core/spread) > > also works: > > user=> (#'clojure.core/spread [:a [:b :c]]) > (:a :b :c) This works for refs but not for atoms. :-/ Stu -- You received this message bec

Re: peeking at private vars in unit tests

2009-12-13 Thread Chouser
On Sun, Dec 13, 2009 at 7:55 PM, Stephen C. Gilardi wrote: > > On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: > >> That's great. I wouldn't have expected it to work. Do you think this is by >> design or coincidental/subject to change? > > The expression I gave was: > >       �...@#'clojure.c

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 6:54 PM, Stuart Halloway wrote: > That's great. I wouldn't have expected it to work. Do you think this is by > design or coincidental/subject to change? The expression I gave was: @#'clojure.core/spread equivalent to: (deref (var clojure.core/spread)) I s

Re: peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
Steve, That's great. I wouldn't have expected it to work. Do you think this is by design or coincidental/subject to change? Stu > > On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: > >> (1) Is there already a form that does this? > > Hi Stuart, > > I think the trick is resolving manually: >

Re: peeking at private vars in unit tests

2009-12-13 Thread Stephen C. Gilardi
On Dec 13, 2009, at 3:19 PM, Stuart Halloway wrote: > (1) Is there already a form that does this? Hi Stuart, I think the trick is resolving manually: user=> @#'clojure.core/spread # user=> (@#'clojure.core/spread [:a :b [:c :d]]) (:a :b :c :d) user=> I

peeking at private vars in unit tests

2009-12-13 Thread Stuart Halloway
(1) Is there already a form that does this? or (2) If not, how can the following be better/simpler: (use 'clojure.contrib.with-ns) (defmacro wall-hack-var "Return the value of a var in a namespace, even if it is private. Intended for test automation." [ns v] `(with-ns '~ns (if

Re: Expanding the unit tests for clojure

2009-12-10 Thread devender
Thanks for updating my clojure-dev membership On Dec 10, 1:33 pm, devender wrote: > Hi, I am interested in expanding the unit test coverage for clojure, I > have signed and mailed in the Agreement and my name now appears on the > clojure contributer page. Could someone PLEASE take my patches and

Expanding the unit tests for clojure

2009-12-10 Thread devender
Hi, I am interested in expanding the unit test coverage for clojure, I have signed and mailed in the Agreement and my name now appears on the clojure contributer page. Could someone PLEASE take my patches and apply it to the code ? Yes I did read "Before you invest time working on a change, discus

New mod code is breaking the contrib unit tests

2009-02-13 Thread Jeffrey Straszheim
I just updated, and the unit tests for mod are breaking. It looks like the new mod only works for ints. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email

_Programming Clojure_ sample code on github, with unit tests

2008-12-08 Thread Stuart Halloway
Hi all, I have placed the sample code for _Programming Clojure_ on github, at http://github.com/stuarthalloway/programming-clojure . Most of the code samples now have unit tests, using Stuart Sierra's test-is. If you see an erratum in the book that you suspect was caused by chang

Re: Stubbing macro for isolated unit tests

2008-11-27 Thread James Reeves
On Nov 24, 6:19 pm, Justin Giancola <[EMAIL PROTECTED]> wrote: > So, you need to evaluate all of the args independently when building > the list literals, possibly with: > (defmacro stub [stubs & body] >   (let [stub-maps >         (reduce (fn [acc [[f & args] res]] >                   (assoc-in

Re: Stubbing macro for isolated unit tests

2008-11-24 Thread Justin Giancola
On Nov 23, 9:56 pm, James Reeves <[EMAIL PROTECTED]> wrote: > On Nov 23, 11:58 pm, Justin Giancola <[EMAIL PROTECTED]> > wrote: > > > Neat. I noticed that you're forcing the arg lists into vectors in both > > make-maps and in stubfn. Since they're not being manipulated at all, > > you could just a

Re: Stubbing macro for isolated unit tests

2008-11-23 Thread James Reeves
On Nov 23, 11:58 pm, Justin Giancola <[EMAIL PROTECTED]> wrote: > Neat. I noticed that you're forcing the arg lists into vectors in both > make-maps and in stubfn. Since they're not being manipulated at all, > you could just as easily leave them as seqs and everything will still > work. The reduc

Re: Stubbing macro for isolated unit tests

2008-11-23 Thread Justin Giancola
this useful: > > (defn stubfn >   "Given a map of argument vectors and return values, construct >   a function to return the value associated with the key of > arguments." >   [result-map] >   (fn [& args] (result-map (vec args > > (defma

Stubbing macro for isolated unit tests

2008-11-23 Thread James Reeves
(vec args (defmacro stub "Create function stubs for isolated unit tests. e.g. (stub [(f 1 2) 3 (f 3 2) 5] (= (+ (f 1 2) (f 3 2)) 8))" [stubs & body] (let [stub-pairs (partition 2 stubs) make-maps (fn [[[f & args] ret]] {

Re: unit tests

2008-10-21 Thread Timothy Pratley
Ah of course! Thanks :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Fo

Re: unit tests

2008-10-21 Thread Stuart Halloway
Hi Tim, You have run afoul of the automagical conversion between Lispy "-" and Javaish "_": ' sad (use 'clojure.contrib.test_is) java.lang.Exception: namespace 'clojure.contrib.test_is' not found after loading '/clojure/contrib/test_is/test_is.clj' (NO_SOURCE_FILE:0 ; happy user=> (use 'clo

Re: unit tests

2008-10-21 Thread J. McConnell
On Tue, Oct 21, 2008 at 12:34 PM, Timothy Pratley <[EMAIL PROTECTED]> wrote: > > I'm a bit stuck on how to load test_is... > I've added a tiny section to the wiki because I couldn't find any > instructions on using contrib, and well I made a lot of mistakes along > the way that other people might

Re: unit tests

2008-10-21 Thread Timothy Pratley
> There's a simple unit testing library in clojure.contrib.test-is. > Look at the source code comments there for examples of how you can > define tests. Thanks Stuart S, I did a subversion grab of the source and well that looks extreemly useful. I'm a bit stuck on how to load test_is... I've add

Re: unit tests

2008-10-21 Thread Timothy Pratley
Thanks Stuart, That's exactly what I was after. On Oct 21, 11:05 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Hi Tim, > > Example below. This is from a demo porting Java code to Clojure, the   > original Java code is in the Apache Commons [1]. Note that test does   > not resolve symbols: > >

Re: unit tests

2008-10-21 Thread Stuart Sierra
Hi Tim, There's a simple unit testing library in clojure.contrib.test-is. Look at the source code comments there for examples of how you can define tests. -Stuart Sierra On Oct 21, 7:57 am, Timothy Pratley <[EMAIL PROTECTED]> wrote: > I've noticed around the place a few hints at testing capabil

Re: unit tests

2008-10-21 Thread Stuart Halloway
Hi Tim, Example below. This is from a demo porting Java code to Clojure, the original Java code is in the Apache Commons [1]. Note that test does not resolve symbols: ; don't do this (test 'index-of-any) -> :no-test ; do this (test #'index-of-any) -> :ok Cheers, Stuart [1] http://svn.apa

unit tests

2008-10-21 Thread Timothy Pratley
I've noticed around the place a few hints at testing capabilities such as (test v) and contrib having a run tests, but I'm at a bit of a loss as to how it fits together. If there is a good example I can take a look at please point me toward it. Generally what I've been doing is writting a test ca