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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:37:51+00:00 2026-06-14T23:37:51+00:00

The Writing functional tests portion of the documentation is pretty skimpy and lacks details

  • 0

The Writing functional tests portion of the documentation is pretty skimpy and lacks details on submitting mock form values completely. I somehow (can’t remember how/where) determined you can submit basic form values (mocking a POST request) by passing a Map to FakeRequest like so:

val Some(result) = routeAndCall(FakeRequest(POST, "/path/to/test", FakeHeaders(),
                                Map("postedVariable" -> Seq("and a value"))))

However, that doesn’t seem to allow for the case of an “uploaded” file.

  • 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-14T23:37:53+00:00Added an answer on June 14, 2026 at 11:37 pm

    Our file upload tests look something like this:

    val tempFile = TemporaryFile(new java.io.File("/tmp/the.file"))
    val part = FilePart[TemporaryFile](key = "image", filename = "the.file", contentType = Some("image/jpeg"), ref = tempFile)
    val formData = MultipartFormData(dataParts = Map(), files = Seq(part), badParts = Seq(), missingFileParts = Seq())
    val result = routeAndCall(FakeRequest(POST, "/path/to/test", FakeHeaders(), formData))
    

    where "image" is the name of the HTML form element you expect to find the file contents in.

    If you are using BodyParsers.maxLength to limit the size of uploads, you can replace formData with Right(formData)

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

Sidebar

Related Questions

I started writing functional tests for my rails app today. I use the RESTful
I'm finding the feedback look pretty slow when running integration and functional tests in
I'm writing functional tests for a chrome app written entirely in javascript. I decided
I'm currently writing some functional tests, and I started wondering what's the best philosophy
I am writing functional tests for Zend application. I run them using PHPUnit and
When writing functional tests, how can I set the value of a select box
I'm writing a django web application, and I'm making unittests & selenium functional tests.
I'm writing functional tests (geb + spock) for a Grails application, and want to
I am in the process of writing some functional tests for a symfony 1.4.19
I am currently writing integration/functional tests for my system. Part of the functionality is

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.