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 6246229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:38:59+00:00 2026-05-24T12:38:59+00:00

I have fully isolated this problem to a very simple play app I think

  • 0

I have fully isolated this problem to a very simple play app
I think it has to do with some DB caching, but I can’t figure it out

BasicTest.java 
========== 
import org.junit.*; 
import play.test.*; 
import play.Logger; 
import models.*; 
import play.mvc.Http.*; 
public class BasicTest extends FunctionalTest { 
    @Before public void setUp() { 
    Fixtures.deleteDatabase(); 
    Fixtures.loadModels("data.yml"); 
    Logger.debug("countFromSetup=%s",User.count()); 
    } 
    @Test 
    public void test() { 
    Response response= GET("/"); 
    Logger.debug("countFromTest=%s",User.count()); 
    assertIsOk(response); 
    } 
} 

Uncommented Configs 
================ 
%prod.application.mode=prod 
%test.application.mode=dev 
%test.db.url=jdbc:h2:mem:play;MODE=MYSQL;LOCK_MODE=0 
%test.db=mysql:root:xxx@t_db 
%test.jpa.ddl=create 
%test.mail.smtp=mock 
application.mode=dev 
application.name=test 
application.secret=jXKw4HabjhaNvosxgzq39to9BJECtOr39EXrEabsQAZKi7YoWAwQWo3B BFUOQnJw 
attachments.path=data/attachments 
date.format=yyyy-MM-dd 
db=mysql:root:xxx@db 
mail.smtp=mock 
Application.java 
============ 
package controllers; 
import play.*; 
import play.mvc.*; 
import models.*; 
public class Application extends Controller { 
    public static void index() { 
    Logger.debug("countFromIndex=%s",User.count()); 
    render(); 
    } 
} 
>play test 

Output of log after running the BasicTest http://localhost:9000/@tests 
================================================== 
11:54:59,008 DEBUG ~ countFromSetup=1 
11:54:59,021 DEBUG ~ countFromIndex=0 
11:54:59,034 DEBUG ~ countFromTest=1 
point to browser=> http://localhost:9000 
12:25:59,781 DEBUG ~ countFromIndex=1 

What happened to the record during?
Response response= GET(“/”);
This ‘bug’ almost makes my test cases useless

  • 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-05-24T12:38:59+00:00Added an answer on May 24, 2026 at 12:38 pm

    It has probably something to do with transactions. I’ve came across a similar case once with Spring/JUnit couple.

    Here is the transactionnal execution of the test (I think) :

    1. Start transaction t1,
    2. Execute setup, result is fetched from cache.
    3. Execute test.
    4. Start transaction t2 for controller execution GET(“/”)
    5. Result is fetched from database but since t1 hasn’t been commmited, it isn’t displayed.
    6. Close transaction t2 and commit t1!
    7. Close transaction t1 and commit t2!

    By the way, that is not really a Functionnal Test. For functionnal tests, you are not supposed to check such data but only http status. Turn to UnitTests for that. When looking at source code of functionnal tests, you can see all the checks implemented are for response/http checking.

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

Sidebar

Related Questions

I discovered to have some problem to fully understand callbacks scoping when trying to
This is something that I have never fully grasped in .NET as to the
I have let's say 2 (but they'll become more in the future) fully decoupled
This would be my issue I have a drop down that's not displaying fully.
Hi Guys I have a fully functioning query, but need to do a little
help rails 3 came out yesterday, we have a fully functional rails 2.3.8 app,
Guys, I need some help! I have a fully rendered menu (a safe html
i have a input tag which is non editable, but some times i need
I have the exact same problem as this post . I want my custom
We have been asked to look into a fully open source solution for a

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.