You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Upayavira <uv...@odoko.co.uk> on 2013/04/02 00:07:48 UTC

Use of SolrJettyTestBase

I'm attempting to use SolrJettyTestBase to test a simple app that pushes
content to Solr.

I've subclassed SolrJettyTestBase, and added a test method (annotated
with @test). However, my test method is never called. I see the
following:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/Users/upayavira/.m2/repository/org/slf4j/slf4j-log4j12/1.7.2/slf4j-log4j12-1.7.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/Users/upayavira/.m2/repository/org/slf4j/slf4j-jdk14/1.6.4/slf4j-jdk14-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/Users/upayavira/apache/lucene/solr/example/solr-webapp/webapp/WEB-INF/lib/slf4j-jdk14-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/Users/upayavira/apache/lucene/solr/solrj/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
Test class requires enabled assertions, enable globally (-ea) or for
Solr/Lucene subpackages only: com.odoko.ArgPostActionTest
NOTE: test params are: codec=null, sim=null, locale=null,
timezone=(null)
NOTE: Mac OS X 10.8.2 x86_64/Oracle Corporation 1.7.0_17
(64-bit)/cpus=8,threads=1,free=85043008,total=96665600
NOTE: All tests run in this JVM: [ArgPostActionTest]
NOTE: reproduce with: ant test  -Dtestcase=ArgPostActionTest
-Dtests.seed=73C46F7785759CEF -Dtests.file.encoding=MacRoman

I'm sure I'm missing something obvious. Any ideas/suggestions as to what
I need to do to make my test actually run??

Upayavira

Re: Use of SolrJettyTestBase

Posted by Erick Erickson <er...@gmail.com>.
I don't see anything obvious, can you set a breakpoint in any other
test and hit it? It's always worked for me if I set a breakpoint and
execute in debug mode...

Not much help,
Erick

On Thu, Apr 11, 2013 at 5:01 PM, Upayavira <uv...@odoko.co.uk> wrote:
> On Tue, Apr 2, 2013, at 12:21 AM, Chris Hostetter wrote:
>> : I've subclassed SolrJettyTestBase, and added a test method (annotated
>> : with @test). However, my test method is never called. I see the
>>
>> You got an immediate failure from the tests setup, because you don'th ave
>> assertions enabled in your JVM (the Lucene & Solr test frameworks both
>> require assertions enabled to run tests because so many important things
>> can't be sanity checked w/o them)...
>>
>> : Test class requires enabled assertions, enable globally (-ea) or for
>> : Solr/Lucene subpackages only: com.odoko.ArgPostActionTest
>>
>> FYI: in addition to that txt being written to System.err, it would have
>> immediately been thrown as an Exception as well.   (see
>> TestRuleAssertionsRequired.java)
>
> So, I've finally found time to get past the enable assertions thingie.
> I've got that sorted. But my test still doesn't stop at breakpoints.
>
> I've got this:
>
> public class ArgPostActionTest extends SolrJettyTestBase {
>
>   @BeforeClass
>   public static void beforeTest() throws Exception {
>     createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
>   }
>
>   @Test
>   public void testArgPostAction() throws SolrServerException {
>           blah.blah.blah
>           assertEquals(response.getResults().getNumFound(), 1);
>   }
> }
>
> Neither of these methods get called when I execute the test. Any ideas
> what's up?
>
> Upayavira

Re: Use of SolrJettyTestBase

Posted by Upayavira <uv...@odoko.co.uk>.
On Tue, Apr 2, 2013, at 12:21 AM, Chris Hostetter wrote:
> : I've subclassed SolrJettyTestBase, and added a test method (annotated
> : with @test). However, my test method is never called. I see the
> 
> You got an immediate failure from the tests setup, because you don'th ave 
> assertions enabled in your JVM (the Lucene & Solr test frameworks both 
> require assertions enabled to run tests because so many important things 
> can't be sanity checked w/o them)...
> 
> : Test class requires enabled assertions, enable globally (-ea) or for
> : Solr/Lucene subpackages only: com.odoko.ArgPostActionTest
> 
> FYI: in addition to that txt being written to System.err, it would have 
> immediately been thrown as an Exception as well.   (see 
> TestRuleAssertionsRequired.java)

So, I've finally found time to get past the enable assertions thingie.
I've got that sorted. But my test still doesn't stop at breakpoints.

I've got this:

public class ArgPostActionTest extends SolrJettyTestBase {

  @BeforeClass
  public static void beforeTest() throws Exception {
    createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
  }

  @Test
  public void testArgPostAction() throws SolrServerException {
          blah.blah.blah
	  assertEquals(response.getResults().getNumFound(), 1);
  }
}

Neither of these methods get called when I execute the test. Any ideas
what's up?

Upayavira

Re: Use of SolrJettyTestBase

Posted by Chris Hostetter <ho...@fucit.org>.
: I've subclassed SolrJettyTestBase, and added a test method (annotated
: with @test). However, my test method is never called. I see the

You got an immediate failure from the tests setup, because you don'th ave 
assertions enabled in your JVM (the Lucene & Solr test frameworks both 
require assertions enabled to run tests because so many important things 
can't be sanity checked w/o them)...

: Test class requires enabled assertions, enable globally (-ea) or for
: Solr/Lucene subpackages only: com.odoko.ArgPostActionTest

FYI: in addition to that txt being written to System.err, it would have 
immediately been thrown as an Exception as well.   (see 
TestRuleAssertionsRequired.java)



-Hoss