Testing controllers in a Play application

15 views
Skip to first unread message

Gavin Baumanis

unread,
Jun 11, 2016, 7:27:16 AM6/11/16
to scalatest-users
Hi there,

I have tests written for all of my Model's functions 
and am turning my attention to the controllers.

But I seem to be having some very basic issues.
(Which isn't of a great surprise to me! for the most part I have been writing my application by googling and adjusting to suit my needs - as opposed to necessarily having a true understanding of 'everything". )

I thought I could start with something simple, like; instantiating the controller and ensuring that it was created successfully.
But I can't even seem to get that to work.

I have found this;

but I must be having a dull moment - because that just isn't me helping me any at the moment!


I have been hunting through my code, looking for where it is that I instantiate the controller class - and I actually can't find such a thing.
Previously I would have been creating my controllers as a singleton (in the "service" layer) and placed them into a long lasting scope.
In my views - I can see me using the methods of the controller as actions  / route destinations - but I don't ever see me actually creating an instance of a controller.


Which leads me to;

I guess I am just not getting something very basic 
So I thought I better ask for some help, before I move forward wasting a whole lot of time - not necessarily even knowing what I am actually looking for!

As always - thanks for anything you might be able to suggest!

-Gavin.



Reply all
Reply to author
Forward
0 new messages