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

Fix parametrized tests #840

Merged
merged 21 commits into from
Jun 12, 2020
Merged

Fix parametrized tests #840

merged 21 commits into from
Jun 12, 2020

Conversation

adamfilipow92
Copy link
Contributor

@adamfilipow92 adamfilipow92 commented Jun 8, 2020

Fixes #809

Test Plan

How do we know the code works?

When test will executed from Flank should have results like same test executed directly on testlab.

Additional information

Test directly executed from test lab

https://console.firebase.google.com/u/0/project/flank-open-source/testlab/histories/bh.da0c237aaa33732/matrices/8109159837961280691

Failed test executed from Flank

https://console.firebase.google.com/u/0/project/flank-open-source/testlab/histories/bh.da0c237aaa33732/matrices/8167982987416424556/executions/bs.38eda8775a39b098
and other with video
https://console.firebase.google.com/u/0/project/flank-open-source/testlab/histories/bh.da0c237aaa33732/matrices/7496090094871625048/executions/bs.160a4ed4fdc86abe

Checklist

  • Documented
  • Unit tested
  • release_notes.md updated
  • Test case with app, yml uploaded
  • Flank should correctly run parametrized tests

Objectives

Parametrized tests classes should be run without splitting into single methods to avoid run errors.

Tests status

https://github.com/adamfilipow92/flank_parametrized_tests/tree/master/test_apk

@codecov-commenter
Copy link

codecov-commenter commented Jun 8, 2020

Codecov Report

Merging #840 into master will increase coverage by 0.09%.
The diff coverage is 95.65%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #840      +/-   ##
============================================
+ Coverage     81.23%   81.33%   +0.09%     
  Complexity      637      637              
============================================
  Files           167      167              
  Lines          3240     3257      +17     
  Branches        463      468       +5     
============================================
+ Hits           2632     2649      +17     
  Misses          343      343              
  Partials        265      265              

@adamfilipow92 adamfilipow92 self-assigned this Jun 8, 2020
@piotradamczyk5 piotradamczyk5 self-assigned this Jun 8, 2020
@jan-goral jan-goral self-assigned this Jun 8, 2020
@@ -0,0 +1,4 @@
gcloud:
app: ./src/test/kotlin/ftl/fixtures/tmp/apk/app-single-success-parametrized-debug.apk
Copy link
Contributor

Choose a reason for hiding this comment

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

Apks shouldn't be added directly to the flank repo, instead we keep them in https://github.com/Flank/test_artifacts to keep the flank repo size small

For the sample app, let's update the source code in this repo so we can easily rebuild the apks. As Android evolves, we'll want to rebuild apks with different options and target platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

.flatMap { annotations -> annotations.values.values }
.filterIsInstance<DecodedValue.DecodedType>()
.map { it.value }
.any { it.toLowerCase().contains("Parameterized".toLowerCase()) }) { // sprawdzamy czy klasa zadana jako parametr adnotacji to Parameterized
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there are any other ways to define tests that can be identified by AndroidJUnitRunner as parameterized

fun shouldHopefullyPass() {
assertTrue(paramOne == paramTwo.toInt())
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

missing newline

@adamfilipow92 adamfilipow92 marked this pull request as ready for review June 9, 2020 15:31
…into #809-Fix-parameterized-testing

# Conflicts:
#	test_runner/src/test/kotlin/ftl/run/platform/android/CreateAndroidTestContextKtTest.kt
Copy link
Contributor Author

@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.

👍 can't give approve

@jan-goral jan-goral force-pushed the #809-Fix-parameterized-testing branch from f915f2d to 7796d4c Compare June 9, 2020 23:21
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.

I shrunk a little the implementation

.any { it.isParameterizedAnnotation() }
}

private fun DecodedValue.DecodedType.isParameterizedAnnotation(): Boolean =
Copy link
Contributor

Choose a reason for hiding this comment

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

This is brilliant! ⭐

@jan-goral jan-goral merged commit 5c58ebd into master Jun 12, 2020
@jan-goral jan-goral deleted the #809-Fix-parameterized-testing branch June 12, 2020 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix parameterized testing
6 participants