Query for Test plan Children - visual-studio

Is there a way in Visual Studio to query for work items by specifying the name or id of the test plan of which they're part?
I have multiple test plans in a single team project so querying on team project alone does not suffice.
As it's not possible to query for all tests by test plan in VS, how are test case linked at database level?
TFS does allow execution of SQL queries using the the MS client libraries using a WorkItemStore instance.
$wiStore = $Collection.GetService([type]"Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore")
$workitems = $wiStore.Query("")
Ultimately I'm attempting to iterate all attachments contained in a test project. Right now this is achieved by retrieving all tests and their (shared) steps and listing their attachments.

Unfortunately,there is no this option in work item queries for now. Example work item queries
Can't find the association between the test plan and test suite (children). The simplest way to query all test suit childrens, you may specify the test suite parent ID {usually =(Test Plan ID+1)}
Update:
I'm not sure if I understood it correctly. If you want to list all tests including the child suite as below. This can be achieved as below.
And it can't be achieved by query for work items in Visual Studio.

Related

How to create different suites and define their order of execution in Godog?

I want to create different test suites for execution of my test cases. The main idea is that I want to load some sample data into database using a feature file in a single suite. After this suite is completed I want to execute different suite containing the test scenarios. Is it possible in GoDog?
There is an example in DATA-DOG repo https://github.com/DATA-DOG/godog/tree/master/examples/db with DB connection it could be helpful. It gives you an opportunity to roll back inserted data before every scenario or suite if you want.

How can I retrieve all action names which are in tests from HP ALM?

In HP ALM there are many test cases.Inside test cases there are many actions.I want to retrieve all the action names from that test cases.
There are multiple approaches, but in all cases you need to get familiar with the(COM) Automation associated with HPE(Microfocus) tools
Approach 1)
Download the Test Case to the FileSystem using the OTA API (HPE ALM Automation); and then traverse the folder structure on your filesystem and look for folders with ActionX names. These are all actions found in the test case(except Action 0 - which is the Test Case or entry point). The name of each action however is binary encoded in one of the files inside the Action folder - (I don't remember exactly which one) so do this only as personal fun, as binary data structures are kinda hard to decode.
Approach 2
Use Quicktest.Application Automation Object and not (only) the HPE ALM one. Start a QTP Application, connect to ALM, open the test case and voila the Automation Object gives you the actions, their names params etc. More info in the Offical Doc
Of course you can combine the 2 objects. Use the OTA API to look up and search Tests in HPE ALM and the Quicktest(UFT) Automation Object to get info about tests(Or even modify them - modify and save does the trick)

Is there a way to find test cases that are not part of any test suite?

The way that we use Microsoft Test Manager means that we want every test case to be included in at least one test suite. However, we have (manually) discovered some test cases that are not part of any test suite. Finding these by hand is very time consuming.
Therefore: Is there any way to find all test cases that are not part of any test suite?
(We're using Microsoft Test Manager 2012/2013.)
You can't do it using MTM (no matter which version you are using).
Using TFS 2012 the only way is to use TFS-API, here a short example how to check if a particular Test Case is a part of any Test Suite:
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.TestManagement.Client;
// Current user credentials will be used to access to TFS
TfsTeamProjectCollection tfsCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(<TFS Url>));
tfsCollection.EnsureAuthenticated();
ITestManagementService testManagementService = tfsCollection.GetService<ITestManagementService>();
ITestManagementTeamProject teamProject = testManagementService.GetTeamProject(<team project name>);
// Get all Test Suites your Test Case belongs to
// (Across all Test Plans in the Team Project)
ITestSuiteCollection testSuites = teamProject.TestSuites.ReferencingTestCase(<test case id>);
bool doesItBelongToAnyTestSuite = testSuites.Any();
If you would use TFS 2013 it will be possible to achieve this using Work Item queries since Test Plan and Test Suite become Work Items with TFS 2013 Update 3 (RC was released on 2. July 2014).

Something similar to NUnit TestCaseSource in Visual Studio unit testing

Is there anything similar to NUnit TestCaseSource attribute in Visual Studio unit testing? The closest solution I found was to use a DataSource. But I don't want to store my test case parameters in a data source.
Datasource is one option to take the test input. You can save your test data in many file format (xml, xls or in sql db)
But if you don't want to store your test data, then use TestInitialize() attribute in any method that will execute before any of your test cases. Save all your test data run time in xml,xls or in sql db through this method and then using datasource use it in your test cases.
Here is msdn link for VSTS unit test. Hope this will help you.

How to use Microsoft built in Tests with NHibernate For Repository Layer(DAL)?

Can any body tell me how to use Microsoft built in Tests with NHibernate For Repository Layer(DAL)?
I'm using NUNIT tests to test NH mappings.
you create test (regular) that create objects, updates them and delete them.
Just like any other test - you assert for the results by checking the DB after the operation.
(if you delete an object, you should be able to "get" it... ect...)
I create a session in the beginning of each test, and close it at the end.
same goes to any other function the dal has...
NUnit website

Resources