| Newsgroups |
gmane.comp.java.junit.user |
| Message-ID |
<CA+nPnMzNoX-EAMt7Rq6L2OR+3o3vTvDR6ds6zLFFhDtYXTYcaQ@mail.gmail.com> |
On 6 October 2014 21:22, 'KARR, DAVID' [email protected] [junit] <
[email protected]> wrote:
>
>
> It’s certainly true that it’s harder to isolate sequencing effects with
> integration and acceptance tests. Are you trying to say that because of
> that, you shouldn’t use JUnit for writing those tests?
>
Nope, more that you should be aware that you may encounter some friction
when writing tests that don't follow the expectations that are valid for
unit tests
>
>
> I also agree that JUnit has “more focus towards unit testing”, but that’s
> because we emphasize that you should write more unit tests compared to
> integration and acceptance tests, because you get more overall value from
> them.
>
I see nothing wrong with a tool being opinionated.... but being a Maven
person I would say that ;-)
> JUnit is a framework for writing automated tests (in my view). It’s
> perfectly fine to say that unit tests should be emphasized over integration
> and acceptance tests. Trying to say that JUnit should only be used for
> writing unit tests just adds to people’s confusion, as that certainly isn’t
> true.
>
I'm not saying not to use it for other types of tests, more saying that it
has a primary focus and using it for other purposes can get friction.
Personally I write my integration and acceptance tests to be independent of
sequencing effects and isolated as I find that such tests provide better
value... but I have worked on projects where that wasn't the case and JUnit
would get used for unit tests and TestNg for the integration tests (as
TestNG provides a sequencing contract)
>
>
> *From:* [email protected] [mailto:[email protected]]
> *Sent:* Monday, October 06, 2014 12:28 PM
> *To:* [email protected]
> *Subject:* Re: [junit] JUnit shouldn't be advertised as only for "unit
> testing"
>
>
>
>
>
> Well the way I see it, JUnit has more focus towards unit testing.
>
>
>
> When writing integration tests and acceptance tests I observe that it is
> harder for people to ensure that tests are isolated and independent of
> sequencing effects.
>
>
>
> Some times this can be for practical purposes such as execution time.
>
>
>
> It can be quicker to chain a number of scenarios together one after the
> other.
>
>
>
> I do not say that this is the correct way to write non-unit tests... but
> it is an observed pattern
>
>
>
> JUnit works hard to maintain the contract that test execution order is
> indeterminate... one might even say it does not work hard enough... but by
> virtue of the indeterminate execution order contract (that was very poorly
> enforced prior to Java 7) the framework has a bias to the sorts of tests
> that are more isolated...
>
>
>
>
>
>
>
> On 6 October 2014 19:25, 'KARR, DAVID' [email protected] [junit] <
> [email protected]> wrote:
>
> One thing I battle in my work is a misconception about what "unit testing"
> is, and what "JUnit" is for. In my view, there are three kinds of
> automated tests: unit, integration, and acceptance. You can easily use
> JUnit to write automated tests for all of these. I often run into people
> who are confused by this, because they think that anything using JUnit is a
> unit test. Even the first page of the JUnit web page adds to this
> confusion. It says:
>
> "JUnit is a simple framework to write repeatable tests. It is an
> instance of the xUnit architecture for unit testing frameworks."
>
> The first statement is good, but not the second one. It would be better
> to change "unit testing" to "automated testing", although "repeatable
> tests" is ok. I don't think there's much point in writing "repeatable
> tests" unless you're going to automate them.
>
> The wikipedia page on JUnit is even worse in this regard. No one here is
> technically responsible for that, but it would be a good idea to revise
> that (I started to look at editing that, but I'd prefer to collaborate with
> existing authors of the page). It should emphasize that JUnit can and
> should be used for any kind of Java-based automated testing, even with
> acceptance testing, which could be used to test deployed packages written
> in any programming language.
>
>
> ------------------------------------
> Posted by: "KARR, DAVID" <[email protected]>
> ------------------------------------
>
>
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
>
>
>
>
>
>