In MTM, how can I reuse a test case in different environments? - microsoft-test-manager

Lets suppose we have a very simple test case: navigate to the homepage of a website. I want to reuse this test case among different test plans for different environments (DEV, QA, PROD). Therefore the location of the service will change depending on the test plan I am using.
How can I ensure that when the tester sees the "Action" instruction in MTM it shows the correct URL for the current environment?
Can I do this based on test plans? Is there a different approach?

You didn't mention that your test is automated so I will give you an answer for manual testing.
In your test case DON'T use specific URL value. Just say "Navigate to the home page of the site."
Crate only one Test Plan.
In the Test Plan create 3 different Test Configurations, one per environment.
In the Test Plan's Properties window add 3 links for each environment. For example, for Qa add new link with Description = Qa & Link = http://qa.myservice/
When you add this Test Case in a Test Suite, right click on the Test Case and select Select test configurations for selected tests and select the configurations (environments) that the test case will run.
When your testers will run the test cases will select the correct link depending on the configuration.

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 to run tests as per respective suite in jmeter

I have created some testcases in Jmeter.
Now I want to run them separately example smoke testcases only.
Is there any way in Jmeter so I can run my JMeter project for a particular group/collection/suite only.
Is Jmeter provide any annotation or containers mechanism from where I can achieve same.
I have written my cases in Jmeter in below assertions
JSR223 Assertion
Response Code
Response Text
Any workaround will be helpful and appreciated in advance
The right way to module your JMeter scripts is to save small script in different JMXs and combined them by calling each or inside a bigger JMX file which uses Include Controller to execute different JMX files
The include controller is designed to use an external JMX file. To use it, create a Test Fragment underneath the Test Plan and add any desired samplers, controllers etc. below it. Then save the Test Plan. The file is now ready to be included as part of other Test Plans.
Inside JMX you can also use Module Controller to reduce code duplication
The Module Controller provides a mechanism for substituting test plan fragments into the current test plan at run-time.
If you want to execute specific test I suggest send specific properties and check the property inside an If Controller .
for example call with property jmeter -JexcludeTest1=true ...
And add an If Controller before test 1:
"${__P(excludeTest1)}" == "true"
The easiest way is using Taurus tool as a wrapper for your JMeter script, it has Modifications for Existing Scripts feature where you can define which test elements you want to enable/disable during test execution.
scenarios:
modification_example:
script: tests/jmx/dummy.jmx
modifications:
disable: # Names of the tree elements to disable
- Thread Group 1
enable: # Names of the tree elements to enable
- Thread Group 2
See Navigating your First Steps Using Taurus to get started.
Another option is putting requests you would like to enable/disable on demand under If Controllers so you could set "run/not run" condition dynamically.

Query for Test plan Children

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.

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).

Queue sub suites for execution in MTM

I have a test plan which contains a test suite which has 4 sub suites of automated test cases. I want to execute all the subsuites one after the other without manual intervention. Is it possible?
try running test cases from command prompt, this requires the least manual intervention, as once all things are set you need to change only the build number to run your test cases.
refer this link

Resources