The accompanying software and tools that are used as aides to testing, rather than the frameworks themselves.
{{tab.selects[0].description}}
Languages: {{tab.selects[0].languages}}
queueValue=`curl -X GET jenkins:8080/view/MyProject/job/myApp/api/json?pretty=true | grep 'queueItem'`
# If there are no builds in the queue, start the job.
if [[ "$queueValue" == *"null"* ]]; then
echo "Trigger Build!"
mkdir -p $WORKSPACE/mytests/build/tmp
echo "Trigger Build!" > $WORKSPACE/ mytests /build/tmp/noqueue.txt;
else
echo "DONT Trigger Build!";
fi
{{tab.selects[0].example1}}
{{tab.selects[1].description}}
Languages: {{tab.selects[1].languages}}
chrisp@chrisp-Aspire-2920:~$ npm install require --save-dev
require@2.4.20 node_modules/require
├── std@0.1.40
└── uglify-js@2.3.0 (async@0.2.10, optimist@0.3.7, source-map@0.1.43)
{{tab.selects[1].example1}}
{{tab.selects[2].description}}
Languages: {{tab.selects[2].languages}}
/**
* *** MOCK SERVICE FOR AN EXTERNAL SERVICE DEPENDENCY ***
*/
public void setUpMockService() {
MockServerClient mockServer = startClientAndServer(MyProperties.portNo);
// Respond with an OK when a PUT request is sent to the services.
mockServer
.when(request()
.withMethod("PUT")
.withPath("/path/to/my/rest/services")
)
.respond(response()
.withStatusCode(200)
);
// Respond with a token when a successful POST request is made to my token generation.
mockServer
.when(request()
.withMethod("POST")
.withPath("/path/to/my/tokens/makeMyToken")
.withBody("username=admin&password=SecretStuff")
)
.respond(response("{\n" +
" \"token\": \"TMm3CKdPjv1m8_h9tv9T4C2nCGcT2QnpLJ9V28hdujWUanQUR67-RDU5TiQsn6AE\",\n" +
" \"expires\": \"1462351478419\"\n" +
"}")
.withStatusCode(200)
.withBody("TMm3CKdPjv1m8_h9tv9T4C2nCGcT2QnpLJ9V28hdujWUanQUR67-RDU5TiQsn6AE")
);
// Respond with a 'not authorized' when an invalid POST request is made to my token generation.
mockServer
.when(request()
.withMethod("POST")
.withPath("/path/to/my/tokens/makeMyToken")
.withBody("username=whoDat&password=NoDat")
)
.respond(response("not authorized")
.withStatusCode(401)
.withBody("not authorized")
);
// Respond with a 'not authorized' when an invalid GET request is made to my REST services.
mockServer
.when(request()
.withMethod("GET")
.withPath("/path/to/my/rest/services")
.withQueryStringParameter("token","InvalidToken")
)
.respond(response("not authorized")
.withStatusCode(503)
);
// Respond with an OK when a valid GET request is made to my REST services.
mockServer
.when(request()
.withMethod("GET")
.withPath("/path/to/my/rest/services")
)
.respond(response("{\"currentVersion\":v1.1,\"services\":[{\"name\":\"MyServiceName\",\"type\":\"A_Service\"}]}")
.withStatusCode(200)
);
}
{{tab.selects[2].example1}}
$httpBackend.expectGET(/\/path\/to\/my\/files\/file.json\?noCache=(.+)/).respond(responseString);
service.getResource(fileName).get().then(function(data){
expect(JSON.stringify(data)).toContain(JSON.stringify(responseString));
});
$httpBackend.flush();
httpBackend.expectPOST(/\/path\/to\/my\/files\?noCache=(.+)/).respond(500,'Internal Server Error');
scope.getFiles(myFiles[0]);
httpBackend.flush();
expect(toasterSpy).toHaveBeenCalledWith('error', 'Failed to get your file.');
{{tab.selects[2].example2}}
{{tab.selects[3].description}}
Languages: {{tab.selects[3].languages}}
chrisp@chrisp-Aspire-2920:~$ ssh 192.168.1.3 -lpi
pi@192.168.1.3's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue May 17 18:09:00 2016 from 192.168.1.17
pi@raspberrypi:~ $ sudo chmod 777 /etc/network/interfaces
pi@raspberrypi:~ $ sudo vim /etc/network/interfaces
{{tab.selects[3].ssh}}
{{tab.selects[3].raspbian}}
chrisp@chrisp-Aspire-2920:~$ sudo apt-get install ssh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-dejavu-extra java-common libatk-wrapper-java libatk-wrapper-java-jni
libgnomevfs2-0 libgnomevfs2-common tzdata-java
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed
ssh
0 to upgrade, 1 to newly install, 0 to remove and 151 not to upgrade.
Need to get 0 B/7,080 B of archives.
After this operation, 96.3 kB of additional disk space will be used.
Selecting previously unselected package ssh.
(Reading database ... 257516 files and directories currently installed.)
Preparing to unpack .../ssh_1%3a6.9p1-2ubuntu0.2_all.deb ...
Unpacking ssh (1:6.9p1-2ubuntu0.2) ...
Setting up ssh (1:6.9p1-2ubuntu0.2) ...
{{tab.selects[3].aptget}}
{{tab.selects[4].description}}
Languages: {{tab.selects[4].languages}}
{{tab.selects[4].maven}}
apply plugin: 'java'
buildscript {
repositories {
mavenCentral()
}
}
dependencies {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '2.53.0'
compile group: 'com.jayway.restassured', name: 'rest-assured', version: '2.+'
compile 'junit:junit:4.12'
}
task uninstallMyApplication(type:Exec) {
def text = project(':buildmyapp').file("/build/holdingarea/myapplication-${project.version}.msi")
commandLine 'msiexec','/quiet','/uninstall',"${text}","/norestart"
}
task installMyApplication(dependsOn:':buildmyapp:build',type:Exec) {
def text = project(':buildmyapp').file("/build/holdingarea/myapplication-${project.version}.msi")
commandLine 'msiexec','/quiet','/I',"${text}","/norestart"
}
task copyMyApplicationLogs(type: Copy) {
def logsPath = System.getenv("ProgramData")+"\\myCompany\\myApplication\\Logs"
from file("${logsPath}")
into "${buildDir}/logsForDebugging"
}
// Install the application to test
test.dependsOn installMyApplication
test {
outputs.upToDateWhen { false }
}
// Uninstall the application to keep the environment clean, and copy the logs for possible debugging.
test.finalizedBy(copyMyApplicationLogs)
test.finalizedBy(uninstallMyApplication)
{{tab.selects[4].gradle}}
{{tab.selects[4].git}}
{{tab.selects[5].description}}
Languages: {{tab.selects[5].languages}}
private void addIssuesToWordDoc() throws Exception {
// Set the hashmap to contain the replacements strings.
// Import the file.
File inputFile = new File(INPUT_DOCX);
// Setup the file to create.
File outputFile = new File(OUTPUT_DOCX);
// Set and prepare the package.
WordprocessingMLPackage myPackage = WordprocessingMLPackage.load(inputFile);
VariablePrepare.prepare(myPackage);
// Get the main document contents.
MainDocumentPart mainDocumentPart = myPackage.getMainDocumentPart();
// Replace parts of the document with strings from the hashmap.
mainDocumentPart.variableReplace(replacements);
// For each Jira, add it as a paragraph to the document to create a vertical list.
for(String jiraRes : getHighPriorityOpenIssues()) {
myPackage.getMainDocumentPart().addParagraphOfText(jiraRes);
}
// Save the document.
myPackage.save(outputFile);
}
{{tab.selects[5].docx4j}}
// Constructor
private JiraQuery() {
RestAssured.authentication = preemptive().basic(MY_USERNAME,MY_PASSWORD);
}
/**
* GET TOTAL NUMBER OF HIGH PRIORITY ISSUES.
* @return String representation of total High Priority issues.
*/
private String getTotalNumberOfHighPriorityIssues() {
return new JSONObject(jiraQueryAsString(JIRA_GET_HIGH_PRIORITY_ISSUES)).get("total").toString();
}
{{tab.selects[5].jira}}
// Test reporting.
task resultsZip(type: Zip) {
classifier = "my_test_results"
from file("build/reports/tests/")
}
test.finalizedBy(resultsZip)
{{tab.selects[5].results}}