question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: follow the "Arrange Act Assert" style for tests

See original GitHub issue

Currently our tests follow the clumsy Four-Phase Test style to describe the test body. I don’t like that at all, as it looks like some old-school stuff which doesn’t play nice with xUnit. My concerns:

  • The // Teardown phase is always empty in xUnit tests as it creates a sut per test, without need to restore it.
  • The // Fixture setup, // Exercise System and // Verify Outcome looks too verbose, while // arrange, // act and // assert are more laconic. If you don’t create test from a template, it’s much simpler to write those words (it’s always hard to write exercise without typos 😅).

Therefore, @moodmosaic if you don’t have any strong objections (I hope you don’t), I would like to switch us to 3 phase tests and use it all our the tests. It will allow me to feel satisfaction during the test creation, rather than pain 😖

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
zvirjacommented, Dec 12, 2017

Usually I use // Act & Assert as it looks more concise and cool 😎 Unless @moodmosaic has concerns, I’d prefer to follow that style 😉

1reaction
zvirjacommented, Dec 16, 2017

Great that it worked! 👍

how do I associate the branch i’m working on in my forked repo to this ticket?

I’d suggest to look at this article, the workflow is well described there: https://github.com/sevntu-checkstyle/sevntu.checkstyle/wiki/Development-workflow-with-Git:-Fork,-Branching,-Commits,-and-Pull-Request

Basically, you don’t need to associate a branch with this issue. Rather, you create a Pull Request and simply mention this issue in the body (e.g. see this one).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrange-Act-Assert: A Pattern for Writing Good Tests
Arrange -Act-Assert is a great way to structure functional test cases. It forces tests to focus on independent, individual behaviors.
Read more >
The Arrange, Act, Assert (AAA) pattern ...
The Arrange, Act, Assert (AAA) pattern is a neat little strategy to help keep your test code cleaner and easier to read and...
Read more >
Unit Testing and the Arrange, Act and Assert (AAA) Pattern
It suggests that you should divide your test method into three sections: arrange, act and assert. Each one of them only responsible for...
Read more >
Are heading comments recommended when unit testing ...
When you need arrange, act, assert comments to make your test understandable you're basically saying "I haven't had time to clean this test...
Read more >
Arrange Act Assert pattern for Python developers - James Cooke
This post introduces the Arrange Act Assert pattern of testing and shows how it can be used in a Python context with Pytest....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found