Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7903605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:47:12+00:00 2026-06-03T09:47:12+00:00

Right now I’ve been maintaining a second sandbox project where I test concepts and

  • 0

Right now I’ve been maintaining a second sandbox project where I test concepts and work through roadblocks. But this is not very efficient as I end up having to duplicate a lot of code and am unable to maintain a durable set of regression tests for my game.

I do have a folder of unit tests within my project, but it is impossible to test components of the framework itself as they depend on platform-specific implementations that are not available to the core branch where development takes place.

I have located the PlayN framework’s set of tests. Is it possible to leverage these for testing one’s own project? Is it possible to include two Game classes within one project?

I see this question was raised here, but it never really got a satisfactory response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:47:14+00:00Added an answer on June 3, 2026 at 9:47 am

    You cannot easily write unit tests that are run against the different backends supported by PlayN. Clearly it would be quite a challenge to automatically run your unit tests on an Android phone or iOS device. However, you can write unit tests that run against the Java backend pretty easily.

    I generally structure my projects such that my core submodule has a test dependency on play n-java and then I run my unit tests using the playn-java backend. I have found this to work reasonably well, though I don’t usually test much that directly interacts with PlayN because it’s hard to unit test visual code. The things I unit test rarely make PlayN calls.

    You can also unit test against the HTML5 backend, but it’s reaaaaally slow. Look at HTMLUnit.

    [edit: since I’m answering this question repeatedly, I’ll add instructions here on how to configure your project to run unit tests against the Java backend]

    Add playn-java to your core/pom.xml as a test dependency:

     <dependency>
       <groupId>com.googlecode.playn</groupId>
       <artifactId>playn-java</artifactId>
       <version>${playn.version}</version>
       <scope>test</scope>
     </dependency>
    

    Add this to your core/pom.xml also:

    <build>
      <plugins>
        <plugin>
          <groupId>com.googlecode.mavennatives</groupId>
          <artifactId>maven-nativedependencies-plugin</artifactId>
          <version>0.0.6</version>
          <executions>
            <execution>
              <id>unpacknatives</id>
              <phase>generate-resources</phase>
              <goals> <goal>copy</goal> </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.12</version>
          <configuration>
            <argLine>-Djava.library.path=${basedir}/target/natives</argLine>
          </configuration>
        </plugin>
      </plugins>
    </build>
    

    which will properly set up LWJGL when running your unit tests.

    Then add this to your unit test:

     static {
         JavaPlatform.register();
     }
    

    Now you can access PlayN.foo() services in your unit tests and they’ll even work.

    You compile and run your tests from Maven like so:

    mvn test
    

    If you need to run your unit tests on a (Unix) build server, you’ll need to ensure that the build server has a headless X windows installation installed along with the Mesa GL libraries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have this SQL query which is valid but always times out:
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
Right now I can use this URL to request a Google Static Maps image
Right now I am working on a stub of a project. In the course
Right now, I'm currently serializing a class like this: class Session { String setting1;
Right now, I have a domain entity named StyleBundle. This StyleBundle takes a list
right now i have this <script type='text/javascript'> $(#beau).click(function(){ $(#beau).animate({margin-Top: 738px}, fast); }); </script> and
this is what i have right now Drawing an RSS feed into the php,
Right now, I miss quite some issues for my project hosted on GitHub. I
Right now I'm doing this: class MyTest(Base): __tablename__ = 'mytest' id = Column(Integer, primary_key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.