-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* created new PR * updated package.json * updating packages file * updated commit with retrieval logic * rebuilt local * updated api call method name * added sample command and removed sleep statement * updated icon * updated task description * updated logic for selecting tests * Updated error message * added null check * removed -v from python invoker * updated resources file * updated task fail logic * updated task fail condition * updated task name * updated * updated deleted files * added utils file * added constants file and console.error * added public doc link * added task failre on api failure * updated if condition * updated error scenario * review comments update * updated indentation * added null checks
- Loading branch information
1 parent
5e0b1b9
commit 2eaf669
Showing
45 changed files
with
4,419 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { spawn } from '../testexecutor' | ||
import tl = require('azure-pipelines-task-lib/task'); | ||
import utils = require('../utils'); | ||
import constants = require('../constants'); | ||
export async function executegradletests(testsToBeExecuted: string[]) { | ||
|
||
//public doc link: https://docs.gradle.org/current/userguide/command_line_interface.html | ||
//gradle command like "gradle test --tests=<package.className.testName> --tests=<package.className.testName>" | ||
|
||
const executable = constants.GRADLE_EXECUTABLE; | ||
const args = [] | ||
|
||
args.push('test'); | ||
|
||
for (let testcase of testsToBeExecuted) { | ||
|
||
// in some cases found that gradle is including () in test name | ||
utils.removeParenthesesFromEnd(testcase); | ||
args.push('--tests=' + testcase); | ||
} | ||
|
||
tl.debug("Executing gradle tests with executable : " + executable); | ||
tl.debug("Executing gradle tests with args :" + args); | ||
|
||
const { status, error } = await spawn(executable, args) | ||
if (error) { | ||
tl.error("Error executing gradle command, " + error); | ||
} | ||
|
||
return { exitCode: status ?? 1 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { spawn } from '../testexecutor' | ||
import tl = require('azure-pipelines-task-lib/task'); | ||
import utils = require('../utils'); | ||
import constants = require('../constants'); | ||
|
||
export async function executemaventests(testsToBeExecuted: string[]) { | ||
|
||
//public doc link: https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html | ||
//maven command like "mvn test -Dtest=<package.className#testName>,<package.className#testName1>" | ||
|
||
const executable = constants.MVN_EXECUTABLE; | ||
const args = [] | ||
const testsToRun =[] | ||
|
||
for (let tests of testsToBeExecuted) { | ||
const modifiedTest = utils.replaceLastDotWithHash(tests); | ||
testsToRun.push(modifiedTest); | ||
} | ||
|
||
if (testsToRun.length > 0) | ||
{ | ||
const testsList = testsToRun.join(',') | ||
const dtest = constants.MAVEN_DTEST; | ||
const combinedTestArgs = dtest + testsList; | ||
|
||
args.push('test'); | ||
args.push(combinedTestArgs); | ||
} | ||
|
||
tl.debug("Executing java maven tests with executable : " + executable); | ||
tl.debug("Executing java maven tests with args :" + args); | ||
|
||
const { status, error } = await spawn(executable, args) | ||
if (error) { | ||
tl.error("Error executing mvn command, " + error); | ||
} | ||
|
||
return { exitCode: status ?? 1 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { spawn } from '../testexecutor' | ||
import tl = require('azure-pipelines-task-lib/task'); | ||
import constants = require('../constants'); | ||
|
||
export async function executepythontests(testsToBeExecuted: string[]) { | ||
|
||
//public doc link: https://docs.pytest.org/en/7.1.x/how-to/usage.html#specifying-which-tests-to-run | ||
//pytest command like "pytest -v <package.className.testName1> <package.className.testName2> --junitxml=junit.xml" | ||
|
||
const executable = constants.PYTEST_EXECUTABLE; | ||
let args: string[] = []; | ||
|
||
for (let testcase of testsToBeExecuted) { | ||
args.push(testcase); | ||
} | ||
|
||
args.push('--junitxml=junit.xml') | ||
|
||
tl.debug("Executing python tests with executable : " + executable); | ||
tl.debug("Executing python tests with args :" + args); | ||
|
||
const { status, error } = await spawn(executable, args) | ||
|
||
if (error) { | ||
tl.error("Error executing pytest command, " + error); | ||
} | ||
|
||
return { exitCode: status ?? 1 } | ||
} |
22 changes: 22 additions & 0 deletions
22
Tasks/AzureTestPlanV0/Strings/resources.resjson/en-US/resources.resjson
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"loc.friendlyName": "Azure Test Plan", | ||
"loc.helpMarkDown": "[Learn more about this task](https://go.microsoft.com/fwlink/?LinkID=613742)", | ||
"loc.description": "Run manual and automated tests in test plan in Java and python language", | ||
"loc.instanceNameFormat": "Azure Test Plan - $(testSelector)", | ||
"loc.input.label.testSelector": "Test cases to be executed", | ||
"loc.input.help.testSelector": "<ul><li><b>Manual tests: </b>Use this option to trigger manual tests from your test plan.</li><li><b>Automated tests: </b>Use this option to run tests from your test plan that have automated test method associated with it.</li>", | ||
"loc.input.label.testPlan": "Test plan", | ||
"loc.input.help.testPlan": "Select a test plan containing test suites with test cases.", | ||
"loc.input.label.testSuite": "Test suite", | ||
"loc.input.help.testSuite": "Select one or more test suites containing test cases.", | ||
"loc.input.label.testConfiguration": "Test configuration", | ||
"loc.input.help.testConfiguration": "Select Test Configuration.", | ||
"loc.input.label.testLanguageInput": "Select Test framework language", | ||
"loc.input.help.testLanguageInput": "Test Framework Language of automated tests in test plan", | ||
"loc.messages.testPlanInput": "Test plan Id : %s", | ||
"loc.messages.testplanConfigInput": "Test plan configuration Id : %s", | ||
"loc.messages.testSuiteSelected": "Test suite Id selected: %s", | ||
"loc.messages.automatedTestsTriggered": "Trigerring execution of Automated tests from test plan", | ||
"loc.messages.ErrorFailTaskOnExecutingTests": "Error occured while executing test command", | ||
"loc.messages.ErrorFailTaskOnAPIFailure": "Error occured while fetching automated tests from test plan inputs" | ||
} |
Oops, something went wrong.