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

  • Home
  • SEARCH
  • 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 8106429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:27:51+00:00 2026-06-06T00:27:51+00:00

When executing ‘play test’, is there a way to pass in system properties to

  • 0

When executing ‘play test’, is there a way to pass in system properties to be used at test cases?

String testDB = System.getProperties().getProperty("testDB");

Map<String, String> conf = new HashMap<String, String>();
if (testDB.equals("localdb")) {
    conf.put("db.default.driver", "org.postgresql.Driver");
    conf.put("db.default.url", "postgres://postgres:postgres@localhost/db");
} else if (testDB.equals("memorydb")) {
    conf.put("db.default.driver", "org.h2.Driver");
    conf.put("db.default.url", "jdbc:h2:mem:play-test");
} else {
    conf.put("db.default.driver", "org.postgresql.Driver");
    conf.put("db.default.url", "postgres://postgres:postgres@localhost/db");
}

running(fakeApplication(conf), new Runnable() {
    public void run() {
    int preRowCount = Info.find.findRowCount();
        Info info = new Info("key");
        info.save();
        assertThat(Info.find.findRowCount()).isEqualTo(preRowCount+1);
        info.delete();
    }
});

I tried ‘play test -DtestDB=localdb’, but got null value in testDB.

  • 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-06T00:27:52+00:00Added an answer on June 6, 2026 at 12:27 am

    1.2.4

    Try play run -DtestDB=localdb --%test

    I found that at the bottom of http://www.playframework.org/documentation/1.2.4/ids where it states that play test is equivalent to play run --%test.

    2.0

    Try play -DtestDB=localdb test

    The system property needs to be before the command.

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

Sidebar

Related Questions

while executing the following query, i get an error that there's an error in
When executing echo 0 > test.txt in cmd.exe, the output in test.txt is 0_
Executing the line: Response.Redirect(Whateva.aspx, true); Results in: A first chance exception of type 'System.Threading.ThreadAbortException'
When executing SubmitChanges to the DataContext after updating a couple properties with a LINQ
After executing gcc -m64 -O test.c -save-temps , I noticed that: mov %edi, %edi
Executing the below code gives me the following exception on the last line: InvalidOperationException:
Executing the following sql: USE [WSS_Content] EXEC sp_helplogins returns two result sets, and within
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals
When executing :make from vim, after make is complete it automatically jumps to a
I´m executing the following command grep bruno < bash.txt which gives me the right

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.