mirror of
https://github.com/game-ci/unity-actions.git
synced 2026-02-03 16:39:06 +08:00
Add failing tests, and actually trigger tests
This commit is contained in:
9
.github/workflows/main.yml
vendored
9
.github/workflows/main.yml
vendored
@@ -35,5 +35,12 @@ jobs:
|
||||
- name: Expose as artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: test results
|
||||
name: 2019.2 test results
|
||||
path: sample-project/playmode-results.xml
|
||||
|
||||
# Upload artifact
|
||||
- name: Expose as artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: 2019.3 test results
|
||||
path: sample-project/test-results.xml
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Tests
|
||||
|
||||
// Then
|
||||
Assert.AreEqual(1, counter.Count);
|
||||
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -26,13 +28,13 @@ namespace Tests
|
||||
{
|
||||
// Given
|
||||
var counter = new BasicCounter(BasicCounter.MaxCount);
|
||||
|
||||
|
||||
// When
|
||||
counter.Increment();
|
||||
|
||||
|
||||
// Then
|
||||
Assert.AreEqual(BasicCounter.MaxCount, counter.Count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ MonoImporter:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace Tests
|
||||
{
|
||||
// Use the Assert class to test conditions
|
||||
Assert.True(true);
|
||||
|
||||
Assert.True(false);
|
||||
}
|
||||
|
||||
// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use
|
||||
|
||||
@@ -6,6 +6,6 @@ MonoImporter:
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@@ -323,7 +323,7 @@ PlayerSettings:
|
||||
tvOS: 1
|
||||
m_BuildTargetGroupLightmapEncodingQuality: []
|
||||
m_BuildTargetGroupLightmapSettings: []
|
||||
playModeTestRunnerEnabled: 0
|
||||
playModeTestRunnerEnabled: 1
|
||||
runPlayModeTestAsEditModeTest: 0
|
||||
actionOnDotNetUnhandledException: 1
|
||||
enableInternalProfiler: 0
|
||||
|
||||
@@ -26,20 +26,39 @@
|
||||
echo $?
|
||||
# Exit code is now 0
|
||||
|
||||
echo "Testing project for $TEST_PLATFORM"
|
||||
echo "Testing the 2019.2 way"
|
||||
# Reference: https://docs.unity3d.com/2019.2/Documentation/Manual/CommandLineArguments.html
|
||||
echo "Using path: $UNITY_PROJECT_PATH"
|
||||
ls -alh $UNITY_PROJECT_PATH
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity \
|
||||
-batchmode \
|
||||
-nographics \
|
||||
-logFile /dev/stdout \
|
||||
-logfile /dev/stdout \
|
||||
-runEditorTests "$UNITY_PROJECT_PATH" \
|
||||
-editorTestsResultFile "$UNITY_PROJECT_PATH/$TEST_PLATFORM-results.xml"
|
||||
# -projectPath "$GITHUB_WORKSPACE" \
|
||||
# -testPlatform $TEST_PLATFORM \
|
||||
# -testResults "$GITHUB_WORKSPACE/$TEST_PLATFORM-results.xml" \
|
||||
# -runTests
|
||||
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
if [ $UNITY_EXIT_CODE -eq 0 ]; then
|
||||
echo "Run succeeded, no failures occurred";
|
||||
elif [ $UNITY_EXIT_CODE -eq 2 ]; then
|
||||
echo "Run succeeded, some tests failed";
|
||||
elif [ $UNITY_EXIT_CODE -eq 3 ]; then
|
||||
echo "Run failure (other failure)";
|
||||
else
|
||||
echo "Unexpected exit code $UNITY_EXIT_CODE";
|
||||
fi
|
||||
|
||||
ls -alh $UNITY_PROJECT_PATH
|
||||
echo "Testing the 2019.3 way"
|
||||
# Reference: https://docs.unity3d.com/2019.3/Documentation/Manual/CommandLineArguments.html
|
||||
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
|
||||
/opt/Unity/Editor/Unity \
|
||||
-batchmode \
|
||||
-logfile /dev/stdout \
|
||||
-runTests "$UNITY_PROJECT_PATH" \
|
||||
-testPlatfrom playmode \
|
||||
-testResults "$UNITY_PROJECT_PATH/test-results.xml"
|
||||
|
||||
UNITY_EXIT_CODE=$?
|
||||
|
||||
@@ -54,6 +73,8 @@ else
|
||||
fi
|
||||
|
||||
echo "Results: "
|
||||
cat $GITHUB_WORKSPACE/$TEST_PLATFORM-results.xml
|
||||
cat $GITHUB_WORKSPACE/$TEST_PLATFORM-results.xml | grep test-run | grep Passed
|
||||
cat "$UNITY_PROJECT_PATH/$TEST_PLATFORM-results.xml"
|
||||
cat "$UNITY_PROJECT_PATH/$TEST_PLATFORM-results.xml" | grep test-run | grep Passed
|
||||
cat "$UNITY_PROJECT_PATH/test-results.xml"
|
||||
cat "$UNITY_PROJECT_PATH/test-results.xml" | grep test-run | grep Passed
|
||||
exit $UNITY_EXIT_CODE
|
||||
|
||||
Reference in New Issue
Block a user