Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E5BA4C13F for ; Wed, 9 May 2012 08:13:21 +0000 (UTC) Received: (qmail 87926 invoked by uid 500); 9 May 2012 08:13:20 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 87684 invoked by uid 500); 9 May 2012 08:13:19 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 87637 invoked by uid 99); 9 May 2012 08:13:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 08:13:17 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dawid.weiss@gmail.com designates 209.85.160.48 as permitted sender) Received: from [209.85.160.48] (HELO mail-pb0-f48.google.com) (209.85.160.48) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 08:13:12 +0000 Received: by pbbrq8 with SMTP id rq8so224014pbb.35 for ; Wed, 09 May 2012 01:12:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; bh=J2OVQJMuOIFZcnfWoVMLiEABX5xIIi4oXN6JoYSLJiw=; b=aSoZ4Vy9GHFbIsddBoHQyI0T3pLdjcI7e9pmLgKbw8IYxAGwsvvAT99t1RnbnhqbUQ 1eTAhG1bmDO1DzJHE2hMRn4nLV57OgQsZ1Et8KLfsERKDXUrO+EpOKaY+aXEkD/jQEyO S+WJ74QO8KTlZTsahXagBmXy8YqMp9a+Eltb1G5bdNT64112F+pAHYF/m+AzxP04+V2H yeZ9WwIhSesI+6mf6lI4QEFOMbJ9EZUx9g7pn37pVATa0sd1XjS5hDWVRZO02BDywfNl G7HPBeM+MZjhd2KK0JQDwHaXVp5YyW3B4zX6IeHCG9bLazVeTwVRTE9WjcA0aPn/bvqQ /gZQ== Received: by 10.68.216.170 with SMTP id or10mr4643075pbc.24.1336551172412; Wed, 09 May 2012 01:12:52 -0700 (PDT) MIME-Version: 1.0 Sender: dawid.weiss@gmail.com Received: by 10.68.46.39 with HTTP; Wed, 9 May 2012 01:12:31 -0700 (PDT) In-Reply-To: References: From: Dawid Weiss Date: Wed, 9 May 2012 10:12:31 +0200 X-Google-Sender-Auth: 7mGVU88u74aRl4o2At6gJAYT-Xw Message-ID: Subject: Re: Annotation for "run this test, but don't fail build if it fails" ? To: dev@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org > That was really the main question i had, as someone not very familiar wit= h > the internals of JUnit, is wether it was possible for our test runner to > make the ultimate decision about the success/fail status of the entire > run based on the annotations of the tests that fail/succed There are two things that need to be distinguished: 1) the "runner" is what's passed to @RunWith(Runner.class). The runner is what is given a suite class and runs its tests (propagating test execution events to any interested listeners). We use RandomizedRunner which manages certain things on top of the default JUnit runner (thread groups, custom annotation for seeds, custom test methods in junit3 style, etc.). 2) ant's task for executing JUnit tests (junit4). This one is responsible for collecting suites, forking jvms and managing listeners. It is also responsible for failing ant's build (by throwing an exception) if requested -- see "haltonfailure" property here http://labs.carrotsearch.com/download/randomizedtesting/1.3.0/docs/junit4-a= nt/Tasks/junit4.html. This is consistent with ANT's default runner. There is some confusion about the two -- in Lucene we use both but you could run suites annotated with RandomizedRunner using any container you want (including standard ANT's task). Unfortunately this also means that whether a build is failed or not is a direct consequence of if any of the tests failed or not. There are no other conditions for this (including complex conditions you mentioned). > I know that things like jenkins are totally fine with the idea of a build > succeeding even if some of the junit testsuite.xml files contain failures This is the "haltonfailure" option. You can actually override it from command line in Lucene build scripts and run full build without stopping on errors -- see ant test-help: [echo] # Run all tests without stopping on errors (inspect log files!). [echo] ant -Dtests.haltonfailure=3Dfalse test > health) but the key question is could we have our test runner say "test > X failed, therefore the build should fail" but also "test Y failed, and > test Y is annotated with @UnstableTest, therefore don't let that failure > fail th entire build. Not really. Not in a way that would be elegant and fit into JUnit listener infrastructure. Read on. > Ultimatley i think it's important that these failures be reported as > faulres -- because that's truly what they are -- we shouldn't try to > sugar coat it, or pretend something happened that didn't. =C2=A0 Ideally = these +1. > I think a Version 2.0 "feature" would be to see agregated historic stats > on the pass/fail rate of every test, regardless of it's annotation, so we > can see: > =C2=A0a) statistically, how often does test X fail on jenkins? > =C2=A0b) statistically, how often does test X fail on my box? > =C2=A0c) statistically, how often does test X fail on your box? oh really= - > that's the same stats that Pete is seeing, but much higher then anyone > else including jenkins and you both run Windows, so maybe there is a > platform specific bug in the code and/or test? This is an interesting idea and I think this could be done by adding a custom report and some marker in an assumption-ignore status... The history is doable (much like execution times currently)... but it's hackish. > =C2=A01) "ant test" > =C2=A0 =C2=A0- treats @UnstableTest the same as @AwaitsFix > =C2=A0 =C2=A0- fails the build if any test fails > =C2=A02) "ant test-unstable" > =C2=A0 =C2=A0- *only* runs @UnstableTest tests > =C2=A0 =C2=A0- doesn't fail the build for any reason > =C2=A0 =C2=A0- puts the result XML files in the same place as "ant test" > =C2=A0 =C2=A0 =C2=A0(so jenkins UI sees them) > =C2=A03) jenkins runs "ant test test-unstable" This is doable by enabling/disabling test groups. A new build plan would need to be created that would do: ant -Dtests.haltonfailure=3Dfalse -Dtests.awaitsfix=3Dtrue -Dtests.unstable=3Dtrue test both awaitsfix and unstable would be disabled by default (and assumption-ignored) so this wouldn't affect anybody else. The above would run all tests without stopping on errors. A post-processing script could then parse json reports (or XML reports) and collect historical statistics. Doable, but honestly this seems like more work (scripts for collecting stats, test groups are trivial) than trying to fix those two or three tests that fail? Dawid --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org