mstest


All test methods in a package/solution in MSTest


I would like to get list of all Test Methods in unit test project/solution. I am using MSTest framework. I would like to get list of all test methods so that I can write some logic to implement logging of all available tests Vs what is executed and which one is being executed etc.,
I am a 1 year old novice in this field. So please provide the detailed explanation or code.
I found a post on how to do this in Nunit and was able to figure out doing it in MSTest.
var tests = new List ();
var testTypes = from t in assembly.GetTypes()
orderby t.Name
select t;
foreach (var type in testTypes)
{
var testMethods = from m in type.GetMethods()
let attributes = m.GetCustomAttributes(typeof(TestMethodAttribute), true)
where attributes != null && attributes.Length > 0
orderby m.Name
select m;
foreach (var method in testMethods)
{
tests.Add(method.Name);
}
}

Related Links

Is it possible to execute code once before all tests run?
Can you Profile Ms test integration tests?
How to get MSTest to work with Gallio/MBUnit?
How to get MSTest to find my test data files?
How to use Microsoft built in Tests with NHibernate For Repository Layer(DAL)?
MS Test Project - Accessor not working properly across assemblies
Is there a more robust way to integration test my persistance layer app.config?
Why PartCover report shows 0% when mstest runs successfully and all tests pass
Relative paths with NCover and MSTest.exe
MSTest doesn't find tests when switching from MbUnit to MSTest
mstest failing to start
MSTest run fails because source assembly is not trusted
What is needed to execute visual studio 2005 web tests?
Can MSTest run a specific method each time it startsup?
How can I emulate MbUnit's [MultipleCulture] attribute in MSTest?
MSTest and custom messages

Categories

HOME
windows
developer-tools
c++11
ggplot2
apache-flink
angular-formly
yahoo-finance
camera
jwplayer
oracle-apex-5
ms-access-2016
database-normalization
aws-cli
dojo
opengl-3
distribution
tput
gource
enterprise-architect
heat
mvc-mini-profiler
feathersjs
soci
swagger-2.0
asp.net-core-webapi
ksh
babel
qliksense
strongname
jboss6.x
draft-js-plugins
expressionengine3
stackexchange
paperjs
python-2.6
turfjs
quickfixj
hibernate-validator
r-grid
jett
sammy.js
gnat-gps
classcastexception
getpixel
modalviewcontroller
watchman
loading
unordered-map
azure-arm
postgresql-8.4
outputcache
avcapturedevice
clang++
x-ray
corruption
wpas
swingworker
branch-prediction
cubism.js
atlas
omniauth-facebook
riot
kiosk
beanstalk
nio2
directdraw
file-move
avahi
mmwormhole
mass-assignment
viewer
appserver
cancellation
ray
websphere-esb
hibernate-entitymanager
gd-graph
away3d
model-driven-development
mongohq
kogrid
cffile
mvc-editor-templates
cnf
time.h
jdb
failing-tests
cross-database
luabind
node-redis
update-statement
automationelement
xui
svk
cac
aspmenu
folding
application-verifier
google-wave
linfu-dynamicproxy
int64
soappy
wspbuilder

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App