XAT Testing Documentation

Jan 10, 2012 at 3:51 PM

Hi Richard,

Do you have any more detailed developer documentation on the full features of XAT testing?

I have looked at the .chm file and also had a look at the object model, and can see that there is a lot more to XAT than the example in the .chm.

At the moment I am particularly looking at how to execute the tests as a particular principal/identity to test role authorisation, but I am sure the more I play the more questions I will have.

Kind regards,

Paul

Coordinator
Jan 10, 2012 at 4:42 PM

I'm sorry, but we don't have more documentation on XAT as yet.  It is something that we originally developed for our own use, and have not yet been able to invest the time documenting fully. 

As you have probably discovered, there is an overloaed SetUser method on AcceptanceTestCase, which allows you to specify a username and roles.  I think this then allows you to test authorzation (by testing whether various properties/actions are visible/usable having set that user)  -  though it is a long time since I've used that particular capability myself.  I'll try and help you if I can.

Jan 11, 2012 at 8:19 AM
Thanks for the update.  Had a quick look at the source code, and although SetUser overload which takes roles is private scope I have managed to get something working.
var roles = new string[] { "Security_ProviderAdministrator" };
var identity = new GenericIdentity("Test User");
var providerAdministrator = new GenericPrincipal(identity, roles);
var testSession = new SimpleSession(providerAdministrator);
NakedObjectsContext.Instance.SetSession(testSession);