Skip to content

Instantly share code, notes, and snippets.

@jmrnilsson
Last active March 2, 2020 14:54
Show Gist options
  • Save jmrnilsson/46bd79cb893d0cf2c95c085b7a419129 to your computer and use it in GitHub Desktop.
Save jmrnilsson/46bd79cb893d0cf2c95c085b7a419129 to your computer and use it in GitHub Desktop.
Get all failed tests from Azure DevOps

How to take a number of tests from Azure DevOps and decorate with a testcategory

1. Open the failing tests in Azure DevOps

  • Run the Javascript mentioned here and put it somewhere.
  • Massage to output into the regular expression in Find-step below.

2. In Visual studio code

  • Choose replace in files
  • Set Find to (public void (some_test_1|some_test_2))
  • Set Replace to [TestCategory("SomeCategory")]\n\t\t$1

3. In git

  • Type git diff to inspect the changes
// Paste in to console when Azure DevOps view is open with some failing tests
var a = document.querySelectorAll(".ms-DetailsRow-cell .clickable-text")
for(var i = 1; i < a.length; i++) { console.log(a[i].innerHTML) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment