Example #1
0
    void CaptureRecording()
    {
        isRecording = false;
        string fileName = $"{test.SceneName}_{test.TimeOfRecord}";

        test.SetInputs();

        var testFolderPath = $"Assets/Tests/PlayMode/Captures/{fileName}";

        Directory.CreateDirectory(testFolderPath);

        //Write the JSON recording here.
        var jsonFilePath = testFolderPath + $"/{fileName}.json";

        using (var sw = new StreamWriter(jsonFilePath))
        {
            var serialized = JsonUtility.ToJson(test);
            sw.Write(JsonUtility.ToJson(test));
        }
        //Write the test C# code
        using (var sw = new StreamWriter(testFolderPath + $"/REC_{fileName}.cs"))
        {
            var csharpClassFriendlyName = "REC_" + test.TimeOfRecord.Replace('-', '_');
            sw.Write(cSharpTemplate(jsonFilePath, csharpClassFriendlyName));
        }
        test = null;
    }
Example #2
0
 void Start()
 {
     test = new RecordedTestData(SceneManager.GetActiveScene().name, SceneManager.GetActiveScene().path, DateTime.UtcNow.ToString("yyyy-MM-dd-HH-mm-ss"));
 }