Not from in container.. as ViewScope is bound to JSF.
But deploying any JSF page that has a ViewScoped bean and using @RunAsClient and simply calling the JSF URL via new URL(..).openStream should invoke the Bean....
maybe you should look into Deltaspike test control module: http://deltaspike.apache.org/documentation/test-control.html
In this kind of integration test you have FaceContext and also CDI scopes active.
Here is a nice example: ee6-ds-demo/PageBeanTest.java at master · os890/ee6-ds-demo · GitHub
Is this feasible? Because I tried in a mixed mode test firstly to call from a @RunAsCient method the jsf page and then in an container method tried to
inject the viewscope Controller bind to the jsf page but still I m getting the
WELD-001303: No active contexts for scope type javax.faces.view.ViewScoped [Proxied because : Original exception caused: class java.lang.ClassNotFoundException: org.jboss.weld.contexts.ContextNotActiveException]
Any suggestions please?