Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add storing output as json #1559

Merged
merged 7 commits into from
Feb 4, 2021

Conversation

piotradamczyk5
Copy link
Contributor

@piotradamczyk5 piotradamczyk5 commented Feb 3, 2021

Fixes #1437

Test Plan

How do we know the code works?

  1. Enable output report using option ( cli: --output-report=json, yaml: output-report: json under flank root)
  2. Run Flank and see that the output reported is stored ( file outputReport.json)
  3. Compare file content with console output

Checklist

  • SDD
  • Documented
  • Unit tested
  • Integration tests updated

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2021

Timestamp: 2021-02-04 17:01:25
Buildscan url for ubuntu-workflow run 537794707

@piotradamczyk5 piotradamczyk5 force-pushed the #1437_add_storing_output_as_json branch from a06b9de to 507205a Compare February 3, 2021 15:13
@piotradamczyk5 piotradamczyk5 marked this pull request as ready for review February 3, 2021 16:06
)
)

private val IArgs.localStorageDirectory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be reusable, wdyt about moving this property to IArgs.kt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will use it in my pr 😄

@piotradamczyk5 piotradamczyk5 force-pushed the #1437_add_storing_output_as_json branch from 57c4f6e to 9baad05 Compare February 4, 2021 15:33
@piotradamczyk5
Copy link
Contributor Author

@Mergifyio rebase

@mergify
Copy link

mergify bot commented Feb 4, 2021

Command rebase: success

Branch has been successfully rebased

@bootstraponline bootstraponline force-pushed the #1437_add_storing_output_as_json branch from 9baad05 to 918a5f7 Compare February 4, 2021 16:50
Copy link
Contributor

@jan-goral jan-goral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Report

Run

From repository root

cd test_runner
flank run android

Result

outputReport.json:

{
  "args": {
    "commonArgs": {
      "data": "---\ngcloud:\n  app: \"../test_projects/android/apks/app-debug.apk\"\n  test: \"../test_projects/android/apks/app-debug-androidTest.apk\"\nflank: {}\n",
      "devices": [
        {
          "model": "NexusLowRes",
          "version": "28",
          "locale": "en",
          "orientation": "portrait",
          "isVirtual": true
        }
      ],
      "resultsBucket": "test-lab-v9cn46bb990nx-kz69ymd4nm9aq",
      "resultsDir": "2021-02-04_16-48-31.143000_OhrI",
      "recordVideo": false,
      "testTimeout": "15m",
      "async": false,
      "flakyTestAttempts": 0,
      "otherFiles": {},
      "directoriesToPull": [],
      "scenarioNumbers": [],
      "failFast": false,
      "project": "flank-open-source",
      "maxTestShards": 1,
      "shardTime": -1,
      "repeatTests": 1,
      "smartFlankGcsPath": "",
      "smartFlankDisableUpload": false,
      "testTargetsAlwaysRun": [],
      "filesToDownload": [],
      "disableSharding": false,
      "localResultDir": "results",
      "runTimeout": "-1",
      "fullJUnitResult": false,
      "ignoreFailedTests": false,
      "keepFilePath": false,
      "outputStyle": "Verbose",
      "disableResultsUpload": false,
      "defaultTestTime": 120.0,
      "defaultClassTestTime": 240.0,
      "useAverageTestTimeForNewTests": false,
      "disableUsageStatistics": false,
      "outputReportType": "JSON"
    },
    "appApk": "/Users/jan-gogo/projects/flank-project/flank/test_projects/android/apks/app-debug.apk",
    "testApk": "/Users/jan-gogo/projects/flank-project/flank/test_projects/android/apks/app-debug-androidTest.apk",
    "additionalApks": [],
    "autoGoogleLogin": false,
    "useOrchestrator": true,
    "roboDirectives": [],
    "environmentVariables": {},
    "grantPermissions": "all",
    "scenarioLabels": [],
    "obbFiles": [],
    "obbNames": [],
    "performanceMetrics": false,
    "testTargets": [],
    "additionalAppTestApks": [],
    "useLegacyJUnitResult": false,
    "obfuscateDumpShards": false,
    "testTargetsForShard": []
  },
  "cost": {
    "physical": 0.00,
    "virtual": 0.02,
    "total": 0.02
  },
  "test_results": {
    "matrix-1g0ipqet4iz4m": [
      {
        "device": "NexusLowRes-28-en-portrait",
        "outcome": "success",
        "details": "1 test cases passed",
        "testSuiteOverview": {
          "total": 1,
          "errors": 0,
          "failures": 0,
          "flakes": 0,
          "skipped": 0,
          "elapsedTime": 1.075,
          "overheadTime": 0.0
        }
      }
    ]
  },
  "weblinks": [
    "https://console.firebase.google.com/project/flank-open-source/testlab/histories/bh.bf178d418be9d33e/matrices/7143386027735431817/executions/bs.6aa4fb040cccf3bb"
  ]
}

Summary

  • The implementation looks good 👍
  • outputResult.json looks as expected

Good Job!

@jan-goral
Copy link
Contributor

We need one review more and test different config

@adamfilipow92
Copy link
Contributor

Please update pr description

Copy link
Contributor

@adamfilipow92 adamfilipow92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Code looks good
  • Output works - tested for ios simple-ios-flank with output-report flag
  • Integration tests works, tested locally (macos)

Here is my outputReport.json

{
  "args": {
    "useLegacyJUnitResult": true,
    "xcTestRunData$delegate": {
      "_value": {
        "rootDir": "/Users/adamfilipowicz/Repos/flank/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/",
        "nsDict": {
          "EarlGreyExampleSwiftTests": {
            "BlueprintName": {
              "content": "EarlGreyExampleSwiftTests"
            },
            "BundleIdentifiersForCrashReportEmphasis": {
              "array": [
                {
                  "content": "io.gogoapps.earlgrey.samples.EarlGreySwiftTests"
                },
                {
                  "content": "io.gogoapps.earlgrey.samples.EarlGrey"
                }
              ]
            },
            "CommandLineArguments": {
              "array": []
            },
            "DefaultTestExecutionTimeAllowance": {
              "type": 0,
              "longValue": 600,
              "doubleValue": 600.0,
              "boolValue": false
            },
            "DependentProductPaths": {
              "array": [
                {
                  "content": "__TESTROOT__/Debug-iphoneos/EarlGreyExampleSwift.app"
                },
                {
                  "content": "__TESTROOT__/Debug-iphoneos/EarlGreyExampleSwift.app/PlugIns/EarlGreyExampleSwiftTests.xctest"
                }
              ]
            },
            "EnvironmentVariables": {
              "DYLD_INSERT_LIBRARIES": {
                "content": "@executable_path/EarlGrey.framework/EarlGrey"
              },
              "OS_ACTIVITY_DT_MODE": {
                "content": "YES"
              },
              "SQLITE_ENABLE_THREAD_ASSERTIONS": {
                "content": "1"
              }
            },
            "IsAppHostedTestBundle": {
              "type": 2,
              "longValue": 1,
              "doubleValue": 1.0,
              "boolValue": true
            },
            "ProductModuleName": {
              "content": "EarlGreyExampleTestsSwift"
            },
            "RunOrder": {
              "type": 0,
              "longValue": 0,
              "doubleValue": 0.0,
              "boolValue": false
            },
            "SystemAttachmentLifetime": {
              "content": "deleteOnSuccess"
            },
            "TestBundlePath": {
              "content": "__TESTHOST__/PlugIns/EarlGreyExampleSwiftTests.xctest"
            },
            "TestHostBundleIdentifier": {
              "content": "io.gogoapps.earlgrey.samples.EarlGrey"
            },
            "TestHostPath": {
              "content": "__TESTROOT__/Debug-iphoneos/EarlGreyExampleSwift.app"
            },
            "TestLanguage": {
              "content": ""
            },
            "TestRegion": {
              "content": ""
            },
            "TestTimeoutsEnabled": {
              "type": 2,
              "longValue": 0,
              "doubleValue": 0.0,
              "boolValue": false
            },
            "TestingEnvironmentVariables": {
              "DYLD_INSERT_LIBRARIES": {
                "content": "__TESTHOST__/Frameworks/libXCTestBundleInject.dylib"
              },
              "XCInjectBundleInto": {
                "content": "unused"
              }
            },
            "ToolchainsSettingValue": {
              "array": []
            },
            "UITargetAppCommandLineArguments": {
              "array": []
            },
            "UserAttachmentLifetime": {
              "content": "deleteOnSuccess"
            }
          },
          "__xctestrun_metadata__": {
            "FormatVersion": {
              "type": 0,
              "longValue": 1,
              "doubleValue": 1.0,
              "boolValue": false
            }
          }
        },
        "version": "V1",
        "shardTargets": {
          "": [
            {
              "EarlGreyExampleSwiftTests": [
                "EarlGreyExampleSwiftTests/testWithGreyAssertions",
                "EarlGreyExampleSwiftTests/testLayout",
                "EarlGreyExampleSwiftTests/testThatThrows",
                "EarlGreyExampleSwiftTests/testWithInRoot",
                "EarlGreyExampleSwiftTests/testCustomAction",
                "EarlGreyExampleSwiftTests/testWithCondition",
                "EarlGreyExampleSwiftTests/testBasicSelection",
                "EarlGreyExampleSwiftTests/testWithCustomMatcher",
                "EarlGreyExampleSwiftTests/testCollectionMatchers",
                "EarlGreyExampleSwiftTests/testCatchErrorOnFailure",
                "EarlGreyExampleSwiftTests/testWithCustomAssertion",
                "EarlGreyExampleSwiftTests/testTableCellOutOfScreen",
                "EarlGreyExampleSwiftTests/testBasicSelectionAndAction",
                "EarlGreyExampleSwiftTests/testBasicSelectionAndAssert",
                "EarlGreyExampleSwiftTests/testWithCustomFailureHandler",
                "EarlGreyExampleSwiftTests/testBasicSelectionActionAssert",
                "EarlGreyExampleSwiftTests/testSelectionOnMultipleElements"
              ]
            }
          ]
        },
        "shardChunks": {
          "": [
            {
              "testMethodNames": [
                "EarlGreyExampleSwiftTests/testWithGreyAssertions",
                "EarlGreyExampleSwiftTests/testLayout",
                "EarlGreyExampleSwiftTests/testThatThrows",
                "EarlGreyExampleSwiftTests/testWithInRoot",
                "EarlGreyExampleSwiftTests/testCustomAction",
                "EarlGreyExampleSwiftTests/testWithCondition",
                "EarlGreyExampleSwiftTests/testBasicSelection",
                "EarlGreyExampleSwiftTests/testWithCustomMatcher",
                "EarlGreyExampleSwiftTests/testCollectionMatchers",
                "EarlGreyExampleSwiftTests/testCatchErrorOnFailure",
                "EarlGreyExampleSwiftTests/testWithCustomAssertion",
                "EarlGreyExampleSwiftTests/testTableCellOutOfScreen",
                "EarlGreyExampleSwiftTests/testBasicSelectionAndAction",
                "EarlGreyExampleSwiftTests/testBasicSelectionAndAssert",
                "EarlGreyExampleSwiftTests/testWithCustomFailureHandler",
                "EarlGreyExampleSwiftTests/testBasicSelectionActionAssert",
                "EarlGreyExampleSwiftTests/testSelectionOnMultipleElements"
              ],
              "testMethods": [
                {
                  "name": "EarlGreyExampleSwiftTests/testWithGreyAssertions",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testLayout",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testThatThrows",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testWithInRoot",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testCustomAction",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testWithCondition",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testBasicSelection",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testWithCustomMatcher",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testCollectionMatchers",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testCatchErrorOnFailure",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testWithCustomAssertion",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testTableCellOutOfScreen",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testBasicSelectionAndAction",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testBasicSelectionAndAssert",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testWithCustomFailureHandler",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testBasicSelectionActionAssert",
                  "time": 120.0,
                  "isParameterized": false
                },
                {
                  "name": "EarlGreyExampleSwiftTests/testSelectionOnMultipleElements",
                  "time": 120.0,
                  "isParameterized": false
                }
              ]
            }
          ]
        }
      }
    },
    "commonArgs": {
      "data": "---\ngcloud:\n  test: \"./test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExample.zip\"\n  xctestrun-file: \"./test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExampleSwiftTests.xctestrun\"\n  results-dir: \"test_dir\"\nflank:\n  output-report: \"json\"\n",
      "devices": [
        {
          "model": "iphone8",
          "version": "13.6",
          "locale": "en",
          "orientation": "portrait",
          "isVirtual": false
        }
      ],
      "resultsBucket": "test-lab-v9cn46bb990nx-kz69ymd4nm9aq",
      "resultsDir": "test_dir",
      "recordVideo": false,
      "testTimeout": "15m",
      "async": false,
      "flakyTestAttempts": 0,
      "otherFiles": {},
      "type": "XCTEST",
      "directoriesToPull": [],
      "scenarioNumbers": [],
      "failFast": false,
      "project": "flank-open-source",
      "maxTestShards": 1,
      "shardTime": -1,
      "repeatTests": 1,
      "smartFlankGcsPath": "",
      "smartFlankDisableUpload": false,
      "testTargetsAlwaysRun": [],
      "filesToDownload": [],
      "disableSharding": false,
      "localResultDir": "results",
      "runTimeout": "-1",
      "fullJUnitResult": false,
      "ignoreFailedTests": false,
      "keepFilePath": false,
      "outputStyle": "Single",
      "disableResultsUpload": false,
      "defaultTestTime": 120.0,
      "defaultClassTestTime": 240.0,
      "useAverageTestTimeForNewTests": false,
      "disableUsageStatistics": false,
      "outputReportType": "JSON"
    },
    "xctestrunZip": "/Users/adamfilipowicz/Repos/flank/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExample.zip",
    "xctestrunFile": "/Users/adamfilipowicz/Repos/flank/test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExampleSwiftTests.xctestrun",
    "testTargets": [],
    "obfuscateDumpShards": false,
    "additionalIpas": [],
    "app": "",
    "testSpecialEntitlements": false,
    "onlyTestConfiguration": "",
    "skipTestConfiguration": ""
  },
  "cost": {
    "physical": 0.08,
    "virtual": 0.00,
    "total": 0.08
  },
  "test_results": {
    "matrix-1iimg89acphkj": [
      {
        "device": "iphone8-13.6-en-portrait",
        "outcome": "success",
        "details": "17 test cases passed",
        "testSuiteOverview": {
          "total": 17,
          "errors": 0,
          "failures": 0,
          "flakes": 0,
          "skipped": 0,
          "elapsedTime": 22.419,
          "overheadTime": 0.0
        }
      }
    ]
  },
  "weblinks": [
    "https://console.firebase.google.com/project/flank-open-source/testlab/histories/bh.a3b607c9bb6d0088/matrices/7683345571758085610/executions/bs.9a78518a6501c50e"
  ]
}

@piotradamczyk5 piotradamczyk5 merged commit cf1b4ba into master Feb 4, 2021
@piotradamczyk5 piotradamczyk5 deleted the #1437_add_storing_output_as_json branch February 4, 2021 18:22
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save flank output as json file
3 participants