Readable unit test - lists of complex objects
up vote
3
down vote
favorite
Goal: Writing more readable tests.
I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of fields inside it. For testing, I'm creating three Datasets: New records, existing records, and expected result.
The problem is, tests are long and hard to read. An example:
test("Merging Movies") {
val newMovies: Dataset[ATMMovie] = Seq(
ATMMovie(
id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("P1"),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ATMMovie(
id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
)
).toDS
val existingMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 658L,
utc_insert_timestamp = Some(94567522333L),
movie_title = Some("Old title"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2-old"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
)
).toDS
val expectedODSMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 765L,
movie_source_id = Some("P1"),
movie_entity_id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
),
ODSMovie( // Movie we had.
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
)
).toDS
As you see, each test is very hard to read and follow. I'm looking to find a better way to write these tests.
Update: I don't care about the value of most of the fields. I'm going to test the logic of merging.
unit-testing scala
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
up vote
3
down vote
favorite
Goal: Writing more readable tests.
I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of fields inside it. For testing, I'm creating three Datasets: New records, existing records, and expected result.
The problem is, tests are long and hard to read. An example:
test("Merging Movies") {
val newMovies: Dataset[ATMMovie] = Seq(
ATMMovie(
id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("P1"),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ATMMovie(
id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
)
).toDS
val existingMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 658L,
utc_insert_timestamp = Some(94567522333L),
movie_title = Some("Old title"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2-old"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
)
).toDS
val expectedODSMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 765L,
movie_source_id = Some("P1"),
movie_entity_id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
),
ODSMovie( // Movie we had.
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
)
).toDS
As you see, each test is very hard to read and follow. I'm looking to find a better way to write these tests.
Update: I don't care about the value of most of the fields. I'm going to test the logic of merging.
unit-testing scala
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
1
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Goal: Writing more readable tests.
I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of fields inside it. For testing, I'm creating three Datasets: New records, existing records, and expected result.
The problem is, tests are long and hard to read. An example:
test("Merging Movies") {
val newMovies: Dataset[ATMMovie] = Seq(
ATMMovie(
id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("P1"),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ATMMovie(
id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
)
).toDS
val existingMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 658L,
utc_insert_timestamp = Some(94567522333L),
movie_title = Some("Old title"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2-old"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
)
).toDS
val expectedODSMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 765L,
movie_source_id = Some("P1"),
movie_entity_id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
),
ODSMovie( // Movie we had.
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
)
).toDS
As you see, each test is very hard to read and follow. I'm looking to find a better way to write these tests.
Update: I don't care about the value of most of the fields. I'm going to test the logic of merging.
unit-testing scala
Goal: Writing more readable tests.
I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of fields inside it. For testing, I'm creating three Datasets: New records, existing records, and expected result.
The problem is, tests are long and hard to read. An example:
test("Merging Movies") {
val newMovies: Dataset[ATMMovie] = Seq(
ATMMovie(
id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("P1"),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ATMMovie(
id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_code = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
)
).toDS
val existingMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 658L,
utc_insert_timestamp = Some(94567522333L),
movie_title = Some("Old title"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2-old"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
)
).toDS
val expectedODSMovies: Dataset[ODSMovie] = Seq(
ODSMovie(
movie_row_id = 765L,
movie_source_id = Some("P1"),
movie_entity_id = 123L,
utc_insert_timestamp = Some(1524522274),
movie_title = Some("New movie from ATM"),
censor_rating_id = Some(0),
release_year = Some(2018),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
internal_pos_movie_id = Some("ID1"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 0
),
ODSMovie(
movie_row_id = 764L,
movie_entity_id = 456L,
utc_insert_timestamp = Some(34567522274L),
movie_title = Some("Title updated"),
censor_rating_id = Some(0),
release_year = Some(2016),
release_date = Some(1524522000),
primary_language_id = Some(0),
distributor_id = Some(0),
movie_source_id = Some("Movie2"),
internal_pos_movie_id = Some("MovieID2"),
temporary = 0,
utc_Last_modified_timestamp = None,
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 3
),
ODSMovie( // Movie we had.
movie_row_id = 2L,
movie_source_id = Some("234"),
movie_entity_id = 7777L,
utc_insert_timestamp = Some(1524522000),
movie_title = Some("Old ODS Movie"),
censor_rating_id = Some(0),
release_year = Some(2017),
release_date = Some(1524522987),
primary_language_id = Some(1),
distributor_id = Some(5),
internal_pos_movie_id = Some("Movie 1"),
temporary = 0,
utc_Last_modified_timestamp = Some(1524522666),
force_update = 0,
utc_last_import_attempt_timestamp = None,
import_attempts = 1
)
).toDS
As you see, each test is very hard to read and follow. I'm looking to find a better way to write these tests.
Update: I don't care about the value of most of the fields. I'm going to test the logic of merging.
unit-testing scala
unit-testing scala
edited Oct 29 at 0:32
asked May 2 at 21:47
Aidin
1163
1163
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
1
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42
add a comment |
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
1
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
1
1
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Our best solution to his was to use a generator-like class or function.
val newMovies = DataFrameBuilder().add(1).add(2)
It generates values for fields based on the number we provide. If type is a number, value will become the number itself. If it's a string, value will become name of the field plus the number (e.g. MOVIE_TITLE 1
)
Another solution was to use a function that takes some of the fields we care about, and fills the rest with constant values. Like, it takes id
and utc_insert_timestamp
, and fills everything e
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Our best solution to his was to use a generator-like class or function.
val newMovies = DataFrameBuilder().add(1).add(2)
It generates values for fields based on the number we provide. If type is a number, value will become the number itself. If it's a string, value will become name of the field plus the number (e.g. MOVIE_TITLE 1
)
Another solution was to use a function that takes some of the fields we care about, and fills the rest with constant values. Like, it takes id
and utc_insert_timestamp
, and fills everything e
add a comment |
up vote
0
down vote
Our best solution to his was to use a generator-like class or function.
val newMovies = DataFrameBuilder().add(1).add(2)
It generates values for fields based on the number we provide. If type is a number, value will become the number itself. If it's a string, value will become name of the field plus the number (e.g. MOVIE_TITLE 1
)
Another solution was to use a function that takes some of the fields we care about, and fills the rest with constant values. Like, it takes id
and utc_insert_timestamp
, and fills everything e
add a comment |
up vote
0
down vote
up vote
0
down vote
Our best solution to his was to use a generator-like class or function.
val newMovies = DataFrameBuilder().add(1).add(2)
It generates values for fields based on the number we provide. If type is a number, value will become the number itself. If it's a string, value will become name of the field plus the number (e.g. MOVIE_TITLE 1
)
Another solution was to use a function that takes some of the fields we care about, and fills the rest with constant values. Like, it takes id
and utc_insert_timestamp
, and fills everything e
Our best solution to his was to use a generator-like class or function.
val newMovies = DataFrameBuilder().add(1).add(2)
It generates values for fields based on the number we provide. If type is a number, value will become the number itself. If it's a string, value will become name of the field plus the number (e.g. MOVIE_TITLE 1
)
Another solution was to use a function that takes some of the fields we care about, and fills the rest with constant values. Like, it takes id
and utc_insert_timestamp
, and fills everything e
answered Oct 29 at 0:37
Aidin
1163
1163
add a comment |
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f193503%2freadable-unit-test-lists-of-complex-objects%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I don't know about Scala syntax, but have you considered migrating data to JSON and parse it from the code instead of having it everything in the code?
– Xtreme Biker
May 3 at 6:31
Without seeing the code that performs this "merging" I find it hard to tell what's going on in here. Without understanding what are you testing, it's hard to suggest improvements for the tests.
– Rene Saarsoo
May 3 at 12:25
1
My team and I typically find that having a "defaults" file in our API test package to be very useful when writing data-oriented tests. If these domain objects need to be used in future, we can rely on the fact that they're determinstic and centralized.
– erip
May 11 at 11:42