Dynamic Test Cases Azure DevOps
Learn to create automatically test cases based on tests in Azure DevOps.
What Is a Dynamic Test Case?
Dynamic test cases are a unique feature in BELLATRIX, where the framework automatically generates test cases in a popular test case management system based on your automated tests. It will populate the title, description, and other necessary properties automatically. Moreover, it will generate human-readable steps and expected results. The most significant benefit is that it will keep up to date your auto-generated test cases over time, no matter what you change in your tests. It is an excellent functionality to allow non-technical people of your company to see what your tests are doing.
The test case is associated automatically to your automated test.
The requirements such as stories, epics, bugs are automatically linked.
The description and preconditions are populated too.
Configuration
When you turn on the feature and will assign listeners to common actions in the framework that will populate the auto-generated test case’s steps and expected results. In the testFrameworkSettings.json file you need to enable the integration.
"dynamicTestCasesSettings": {
"isEnabled": "true"
},
"azureDevOpsDynamicTestCasesSettings": {
"isEnabled": "true",
"url": "https://dev.azure.com/yourOrganization",
"token": "authenticationToken",
"organizationName": "yourOrganizationName",
"projectName": "yourProjectName"
},
You can read the the following article how to generate an authentication token. The last step is to configure the test classes and tests.
[TestFixture]
[AzureDevOpsDynamicTestCase(AreaPath = "AutomateThePlanet", IterationPath = "AutomateThePlanet", RequirementId = "482")]
public class PageObjectsTests : WebTest
{
[Test]
[AzureDevOpsDynamicTestCase(Description = "Create a purchase of a rocket through the online rocket shop http://demos.bellatrix.solutions/")]
public void PurchaseRocketWithPageObjects()
{
App.TestCases.AddPrecondition($"Navigate to http://demos.bellatrix.solutions/");
var homePage = App.GoTo<HomePage>();
homePage.FilterProducts(ProductFilter.Popularity);
homePage.AddProductById(28);
homePage.ViewCartButton.Click();
var cartPage = App.Create<CartPage>();
cartPage.ApplyCoupon("happybirthday");
cartPage.ProceedToCheckout.Click();
var billingInfo = new BillingInfo
{
FirstName = "In",
LastName = "Deepthought",
Company = "Automate The Planet Ltd.",
Country = "Bulgaria",
Address1 = "bul. Yerusalim 5",
Address2 = "bul. Yerusalim 6",
City = "Sofia",
State = "Sofia-Grad",
Zip = "1000",
Phone = "+00359894646464",
Email = "info@bellatrix.solutions",
ShouldCreateAccount = true,
OrderCommentsTextArea = "cool product",
};
var checkoutPage = App.Create<CheckoutPage>();
checkoutPage.FillBillingInfo(billingInfo);
checkoutPage.CheckPaymentsRadioButton.Click();
}
}
[AzureDevOpsDynamicTestCase(SuiteId = "8260474")]
On top of your class you need to place the AzureDevOpsDynamicTestCase attribute and specify the area, iteration and maybe an ID of a story to be associated.
[AzureDevOpsDynamicTestCase(Description = "Create a purchase of a rocket through the online rocket shop http://demos.bellatrix.solutions/")]
On top of your class, you need to place the DynamicTestCase attribute and optionally you can specify custom test case name and description.
App.TestCases.AddPrecondition($"Navigate to http://demos.bellatrix.solutions/");
Through TestCases property, you can add preconditions, custom steps, or expected results. You have access to it through the App service or directly in the BELLATRIX page objects.