Skip to content

Commit

Permalink
Merge pull request #235 from bugsnag/tms/mobile-fixture
Browse files Browse the repository at this point in the history
Mobile targets test fixture foundation
  • Loading branch information
twometresteve authored May 4, 2021
2 parents daf9228 + 247641d commit 499cdab
Show file tree
Hide file tree
Showing 56 changed files with 8,601 additions and 44 deletions.
45 changes: 1 addition & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,55 +1,13 @@
GIT
remote: https://github.com/bugsnag/maze-runner
revision: 7377529a77eb7585afc66cd2080fcdc4eea3306a
branch: v1
specs:
bugsnag-maze-runner (1.1.0)
cucumber (~> 3.1.0)
cucumber-expressions (= 5.0.15)
minitest (~> 5.0)
os (~> 1.0.0)
rack (~> 2.0.0)
rake (~> 12.3.3)
test-unit (~> 3.2.0)

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
atomos (0.1.3)
backports (3.18.2)
builder (3.2.4)
claide (1.0.2)
colored2 (3.1.2)
cucumber (3.1.0)
builder (>= 2.1.2)
cucumber-core (~> 3.1.0)
cucumber-expressions (~> 5.0.4)
cucumber-wire (~> 0.0.1)
diff-lcs (~> 1.3)
gherkin (~> 5.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (3.1.0)
backports (>= 3.8.0)
cucumber-tag_expressions (~> 1.1.0)
gherkin (>= 5.0.0)
cucumber-expressions (5.0.15)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
diff-lcs (1.4.4)
gherkin (5.1.0)
minitest (5.14.2)
multi_json (1.15.0)
multi_test (0.1.2)
nanaimo (0.2.6)
os (1.0.1)
power_assert (1.2.0)
rack (2.0.9)
rake (12.3.3)
rouge (2.0.7)
test-unit (3.2.9)
power_assert
xcodeproj (1.5.9)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.2)
Expand All @@ -63,10 +21,9 @@ PLATFORMS
ruby

DEPENDENCIES
bugsnag-maze-runner!
rake
xcodeproj
xcpretty

BUNDLED WITH
2.1.4
2.2.13
46 changes: 46 additions & 0 deletions test/mobile/features/fixtures/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Prebuilt stuffs
Sample*

[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
Assets/AssetStoreTools*

# Visual Studio cache directory
.vs/
.vsconfig

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.opendb

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Imported assets
Assets/Plugins
Assets/Plugins.meta
Assets/Standard\ Assets/Bugsnag/BugsnagBehaviour.cs

# Builds
*.apk
*.unitypackage

11 changes: 11 additions & 0 deletions test/mobile/features/fixtures/Assets/OtherSceneScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class OtherSceneScript : MonoBehaviour {

public void ReturnToSample() {
SceneManager.LoadScene("SampleScene");
}
}
11 changes: 11 additions & 0 deletions test/mobile/features/fixtures/Assets/OtherSceneScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Parky">
<application android:usesCleartextTraffic="true" android:label="@string/app_name" android:icon="@mipmap/app_icon">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
130 changes: 130 additions & 0 deletions test/mobile/features/fixtures/Assets/ReporterBehavior.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
using System;
using UnityEngine;
using BugsnagUnity;
using System.Collections.Generic;
using BugsnagUnity.Payload;
using UnityEngine.SceneManagement;

public class ReporterBehavior : MonoBehaviour {

// Use this for initialization
void Start () {
Configuration config = new Configuration("12312312312312312312312312312312");
config.Endpoint = new Uri("http://192.168.178.53:9339/notify");
config.Endpoint = new Uri("http://192.168.178.53:9339/session");
config.Context = "My context";
config.AppVersion = "1.2.3";
Bugsnag.Start(config);
}

public void ThrowException() {
throw new System.Exception("You threw an exception!");
}

public void AssertionFailure() {
var items = new int[]{1, 2, 3};
Debug.Log("Item4 is: " + items[4]);
}

public void NativeException() {
BugsnagNative.Crash();
}

public void LogCaughtException() {
try {
var items = new int[]{1, 2, 3};
Debug.Log("Item4 is: " + items[4]);
} catch (System.Exception ex) {
Debug.LogException(ex);
}
}

public void LogWithClasPrefix() {
throw new ExecutionEngineException("Haven't gotten around to making this work, sorry");
}

public void NotifyCaughtException() {
try {
var items = new int[]{1, 2, 3};
Debug.Log("Item4 is: " + items[4]);
} catch (System.Exception ex) {
Bugsnag.Notify(ex);
}
}
public void NotifyWithCallback() {
Bugsnag.Notify(new ExecutionEngineException("This one has a callback"), report =>
{
report.Context = "Callback Context";
report.Metadata.Add("Callback", new Dictionary<string, string>()
{
{"region", "US"}
});
});
}
public void StartSession() {
Bugsnag.SessionTracking.StartSession();
}
public void SetUser() {
Bugsnag.User.Id = "mcpacman";
Bugsnag.User.Name = "Geordi McPacman";
Bugsnag.User.Email = "[email protected]";
}
public void ClearUser() {
Bugsnag.User.Clear();
}
public void AddMetadata() {
Bugsnag.Metadata.Add("ConfigMetadata", new Dictionary<string, string>(){
{ "subsystem", "Player Mechanics" }
});
}
public void AddCallbackMetadata() {
Bugsnag.BeforeNotify(report =>
{
report.Metadata.Add("CallbackMetadata", new Dictionary<string, string>(){
{ "subsystem", "Player Mechanics" }
});
});
}
public void AddCallbackContext() {
Bugsnag.BeforeNotify(report =>
{
report.Context = "BeforeNotify Context";
});
}
public void AddCallbackUser() {
Bugsnag.BeforeNotify(report =>
{
report.User.Id = "lunchfrey";
report.User.Name = "Lunchfrey Jones";
report.User.Email = "[email protected]";
});
}
public void AddCallbackSeverity() {
Bugsnag.BeforeNotify(report =>
{
report.Severity = Severity.Info;
});
}
public void AddCallbackCancellation() {
Bugsnag.BeforeNotify(report =>
{
report.Ignore();
});
}
public void RemoveAllCallbacks() {
throw new ExecutionEngineException("Hmm, doesn't seem to exist");
}
public void LeaveBreadcrumbString() {
Bugsnag.Breadcrumbs.Leave("String breadcrumb clicked");
}
public void LeaveBreadcrumbTuple() {
Bugsnag.Breadcrumbs.Leave(
"Tuple breadcrumb clicked",
BreadcrumbType.Navigation,
new Dictionary<string, string>() {{ "scene", "SomeVeryRealScene" }}
);
}
public void ChangeScene() {
SceneManager.LoadScene("OtherScene");
}
}
11 changes: 11 additions & 0 deletions test/mobile/features/fixtures/Assets/ReporterBehavior.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/mobile/features/fixtures/Assets/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 499cdab

Please sign in to comment.