Skip to content

Commit

Permalink
Adding Linux scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
devtest committed Aug 4, 2016
1 parent 5bc6cff commit 715371e
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 8 deletions.
27 changes: 27 additions & 0 deletions deploy-jtest-monitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

echo ===================================================================
echo "Deploying Jtest Application Coverage Monitor for build.id="$BUILD_ID
echo ===================================================================

echo **1/2** Cleaning up old coverage data
rm -f $APP_COVERAGE_DIR/monitor/runtime_coverage/runtime_coverage*

echo **2/2** Copy and unzip monitor package
cp target/jtest/monitor/monitor.zip $APP_COVERAGE_DIR

pushd $APP_COVERAGE_DIR
unzip -o monitor.zip
popd

echo ===================================================================
echo "Finished deploying Jtest Application Coverage Monitor for build.id="$BUILD_ID
echo ===================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
23 changes: 23 additions & 0 deletions jtest-ft-cov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

echo ===================================================================
echo Calculating Application Coverage against build.id=$BUILD_ID
echo ===================================================================

echo **1/2** Calculating coverage
jtestcli -config "builtin://Calculate Application Coverage" -staticcoverage $APP_COVERAGE_DIR/monitor/static_coverage.xml -runtimecoverage $APP_COVERAGE_DIR/monitor/runtime_coverage -property build.id=$BUILD_ID -property dtp.project=$DTP_PROJECT -property report.coverage.images="Parabank-FT;Parabank-All" -report jtest-ft-cov -property session.tag="parabank-win32_x86_64" > jtest-ft-cov-$RUN_TIME.log 2>&1

echo **2/2** Cleaning up processed coverage data
rm $APP_COVERAGE_DIR/monitor/runtime_coverage/runtime_coverage*

echo =================================================================
echo "Finished Calculating Application Coverage for build.id="$BUILD_ID
echo =================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
8 changes: 4 additions & 4 deletions jtest-mt-cov.bat
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@echo off
IF %1.==. (
echo "Incorrect usage ... requires build_id (e.g. PARABANK3-%date:~10,4%%date:~4,2%%date:~7,2%-<BUILD_NUMBER>)"
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>"
GOTO End
)
IF %2.==. (
echo "Incorrect usage ... requires report.xml file)"
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>"
GOTO End
)
IF NOT EXIST %2 (
echo "Incorrect usage ... %2 does not exist"
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>
echo "Usage: jtest-mt-cov.bat <BUILD_ID> <REPORT XML>"
GOTO End
)

Expand Down Expand Up @@ -40,4 +40,4 @@ echo =================================================================
echo Finished processing Manual test results for build.id=%BUILD_ID%
echo =================================================================

:End
:End
44 changes: 44 additions & 0 deletions jtest-mt-cov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

if [ -z "$1"]; then
echo "Incorrect usage ... requires build_id (e.g. PARABANK3-<DATE>-<BUILD_NUMBER>)"
echo "Usage: jtest-mt-cov.sh <BUILD_ID> <REPORT XML>"
exit
fi
if [ -z "$2"]; then
echo "Incorrect usage ... requires report.xml file)"
echo "Usage: jtest-mt-cov.sh <BUILD_ID> <REPORT XML>"
exit
fi
if [ ! -f "$2" ]; then
echo "Incorrect usage ... $2 does not exist"
echo "Usage: jtest-mt-cov.sh <BUILD_ID> <REPORT XML>"
exit
fi

export BUILD_ID=$1

echo ===================================================================
echo "Processing Manual test result for build.id="$BUILD_ID
echo ===================================================================

echo **1/3** Uploading report to DTP
curl -k --user admin:admin -F file=@$2 https://localhost:8082/api/v2/dataCollector

echo **2/3** Processing Coverage
jtestcli -config "builtin://Calculate Application Coverage" -staticcoverage $APP_COVERAGE_DIR/monitor/static_coverage.xml -runtimecoverage $APP_COVERAGE_DIR/monitor/runtime_coverage -property build.id=$BUILD_ID -property dtp.project=$DTP_PROJECT -property report.coverage.images="Parabank-MT;Parabank-All" -report jtest-mt-cov -property session.tag="manual-win32_x86_64" > jtest-mt-cov-$RUN_TIME.log 2>&1

echo **3/3** Cleaning up processed coverage data
rm $APP_COVERAGE_DIR/monitor/runtime_coverage/runtime_coverage*

echo =================================================================
echo "Finished processing Manual test results for build.id="$BUILD_ID
echo =================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
4 changes: 2 additions & 2 deletions jtest-sa-ut-delta.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IF NOT EXIST set-vars.bat (
)
call set-vars

set BUILD_ID=PARABANK3-%date:~10,4%%date:~4,2%%date:~7,2%-%BUILD_NUMBER%delta
set BUILD_ID=%BUILD_ID%delta

echo ===================================================================
echo Running Static Analysis and Unit Tests against CHANGED CODE build.id=%BUILD_ID%
Expand All @@ -27,4 +27,4 @@ echo =================================================================
echo Finished Static Analysis and Unit Testing of CHANGED CODE build.id=%BUILD_ID%
echo =================================================================

:End
:End
31 changes: 31 additions & 0 deletions jtest-sa-ut-delta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

export BUILD_ID=$BUILD_ID"delta"

echo ===================================================================
echo Running Static Analysis and Unit Tests against build.id=$BUILD_ID
echo ===================================================================

echo **1/3** Execute Static Analysis: Recommended Rules
mvn jtest:jtest -Djtest.config="jtest.dtp://Recommended Rules" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-sa -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-sa-$RUN_TIME.log 2>&1

# echo **X/X** (Optional) Execute Static Analysis: All Rules
# mvn jtest:jtest -Djtest.config="jtest.dtp://All Rules" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-sa-all -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-sa-all-$RUN_TIME.log 2>&1

echo **2/3** Execute Metrics
mvn jtest:jtest -Djtest.config="jtest.dtp://Metrics" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-ma -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-ma-$RUN_TIME.log 2>&1

echo **3/3** Execute Unit Tests
mvn process-test-classes jtest:agent test jtest:jtest -Djtest.config="builtin://Unit Tests" -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Dproperty.build.id=$BUILD_ID -Dproperty.report.coverage.images="Parabank-UT;Parabank-All" -Dproperty.console.verbosity.level=high -Djtest.showsettings=true -Djtest.report=jtest-ut > jtest-ut-$RUN_TIME.log 2>&1

echo =================================================================
echo Finished Static Analysis and Unit Testing of build.id=$BUILD_ID
echo =================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
29 changes: 29 additions & 0 deletions jtest-sa-ut.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

echo ===================================================================
echo Running Static Analysis and Unit Tests against build.id=$BUILD_ID
echo ===================================================================

echo **1/3** Execute Static Analysis: Recommended Rules
mvn jtest:jtest -Djtest.config="jtest.dtp://Recommended Rules" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-sa -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-sa-$RUN_TIME.log 2>&1

# echo **X/X** (Optional) Execute Static Analysis: All Rules
# mvn jtest:jtest -Djtest.config="jtest.dtp://All Rules" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-sa-all -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-sa-all-$RUN_TIME.log 2>&1

echo **2/3** Execute Metrics
mvn jtest:jtest -Djtest.config="jtest.dtp://Metrics" -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Djtest.showsettings=true -Djtest.report=jtest-ma -Dproperty.console.verbosity.level=high -Dproperty.build.id=$BUILD_ID > jtest-ma-$RUN_TIME.log 2>&1

echo **3/3** Execute Unit Tests
mvn process-test-classes jtest:agent test jtest:jtest -Djtest.config="builtin://Unit Tests" -Dmaven.test.failure.ignore=true -Dproperty.dtp.project=$DTP_PROJECT -Dproperty.build.id=$BUILD_ID -Dproperty.report.coverage.images="Parabank-UT;Parabank-All" -Dproperty.console.verbosity.level=high -Djtest.showsettings=true -Djtest.report=jtest-ut > jtest-ut-$RUN_TIME.log 2>&1

echo =================================================================
echo Finished Static Analysis and Unit Testing of build.id=$BUILD_ID
echo =================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
14 changes: 14 additions & 0 deletions set-vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

#**** Setup
export DTP_PROJECT=Parabank-v3
export RUN_DATE=`date +%Y%m%d`
export BUILD_ID=PARABANK3-$RUN_DATE-$BUILD_NUMBER
export RUN_TIME=`date +%Y%m%d%H%M`

export APP_COVERAGE_DIR=/tmp

echo ===================================================================
echo DTP Project:$DTP_PROJECT "("$RUN_TIME")"
echo ===================================================================

4 changes: 2 additions & 2 deletions soatest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ echo ===================================================================
pushd soatest
call copy /Y templatesettings.properties localsettings.properties
echo build.id=%BUILD_ID% >> localsettings.properties
echo property.dtp.project=%DTP_PROJECT% >> localsettings.properties
echo general.project=%DTP_PROJECT% >> localsettings.properties
echo session.tag=%DTP_PROJECT%-${config_name} >> localsettings.properties

echo ======================Parabank==============================
Expand Down Expand Up @@ -47,4 +47,4 @@ echo =================================================================
echo Finished Functional Tests of build.id=%BUILD_ID%
echo =================================================================

:End
:End
50 changes: 50 additions & 0 deletions soatest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

if [ -f "set-vars.sh" ]; then

source set-vars.sh

echo ===================================================================
echo Running Functional Tests against build.id=$BUILD_ID
echo ===================================================================

pushd soatest
cp templatesettings.properties localsettings.properties
echo build.id=$BUILD_ID >> localsettings.properties
echo general.project=$DTP_PROJECT >> localsettings.properties
echo session.tag=$DTP_PROJECT-${config_name} >> localsettings.properties

echo ======================Parabank==============================

echo **1/3** Importing project into SOAtest
soatestcli -data . -import TestAssets

echo "**2/3** Running SOAtest (Parabank)"
rm report-parabank/*.*
soatestcli -config "user://Example Configuration" -data . -resource TestAssets -report report-parabank -localsettings localsettings.properties > soatest-parabank-$RUN_TIME.log 2>&1

echo **3/3** Uploading report to DTP
curl -k --user admin:admin -F file=@report-parabank/report.xml https://localhost:8082/api/v2/dataCollector
popd

echo ======================Bookstore==============================
pushd soatest

echo **1/3** Importing project into SOAtest
soatestcli -data . -import Bookstore

echo "**2/3** Running SOAtest (Bookstore)"
rm report-bookstore/*.*
soatestcli -config "ApplicationCoverage.properties" -data . -resource Bookstore -report report-bookstore -localsettings localsettings.properties > soatest-bookstore-$RUN_TIME.log 2>&1

echo **3/3** Uploading report to DTP
curl -k --user admin:admin -F file=@report-bookstore/report.xml https://localhost:8082/api/v2/dataCollector
popd

echo =================================================================
echo Finished Functional Tests of build.id=$BUILD_ID
echo =================================================================

else
echo "Incorrect usage ... running script in wrong directory, cannot find setvars.sh"
fi
1 change: 1 addition & 0 deletions soatest/stubs/stubs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<stubs version="2"/>
5 changes: 5 additions & 0 deletions soatest/templatesettings.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
license.network.host=localhost
license.network.port=2002
soatest.license.network.edition=server_edition
soatest.license.use_network=true

report.active_rules=false
report.associations=false
report.authors_details=true
Expand Down

0 comments on commit 715371e

Please sign in to comment.