c# - How to host VS IDE during integration test via MSTest? -



c# - How to host VS IDE during integration test via MSTest? -

i have created integration test project test vs extension. if run tests visual studio ide, tests running fine , every method spawns new vs ide. test methods marked next attributes:

[hosttype("vs ide")] [testmethod] public void testwhatevermethod() { ... }

however if seek automate tests, , run them commandline via mstest (or vstest) got next error message, tests hosted within vs ide:

the host type 'vs ide' cannot loaded next reason: key 'vs ide' cannot found. create sure appropriate host adapter installed on machine.

therefore tried find solution at: msdn - how to: install host adapter. documented vs2005 , 2008.

i inquire directions regarding vs 2013, can found out more? or missing? proper way run integration tests outside vs ide? how 1 can host ide programmatically?

thank in advance!

i realized how it, without using hosttype attribute. next code snippet can help out others well:

type visualstudiotype = type.gettypefromprogid("visualstudio.dte.12.0", true); dte env = activator.createinstance(visualstudiotype, true) dte;

this type of vs, specified version , throw exception on error. dte interface of envdte, 1 can use.

to services, following, e.g. ui shell:

serviceprovider serviceprovider = new serviceprovider(env microsoft.visualstudio.ole.interop.iserviceprovider); ivsuishell uishell = (ivsuishell)serviceprovider.getservice(typeof(svsuishell));

one should maintain track of services, rcw handle , release com object afterwards usage.

c# visual-studio testing visual-studio-2013 automated-tests

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -