BDD unit test in XCode

Hi,
I can’t describe how to translate my analyst sentences according to BDD. My first sentence is “list accounts counts of the accounts different from 1 the account balance should different from 0, try to select a destination account.”

I think;
override func spec() {
describe(“list accounts”) {
context(“count of accounts different from 1”) {
it(“the account balance should different from 0”) {
try! try select.destination.account
// bla bla…
}
}
}
}

IS it true ? Please check and say your commit.
Thank you,

Hi @tursunserap,
Would you like to rephrase your question? It would be understandable if you do, not sure what you really want.

cheers,

Jayant

Hi @jayantvarma ,

I am new in BDD and I try to develop unit test according to BDD. I am not sure what I did. My first question is about my first unit test case. Now, is it understandable?

Thank you

Hi @tursunserap, I think you are on the right track with using quick and nimble approach with BDD. I’m assuming you took a look at the tutorial, https://www.raywenderlich.com/135-behavior-driven-testing-tutorial-for-ios-with-quick-nimble? In the example they use this approach below.

  1. describe() is used to define what action or behavior you’ll be testing.
  2. context() is used to define the specific context of the action you’ll be testing.
  3. it() is used to define the specific expected result for the test.
  4. You play a random move on the Board class using playRandom() .

From what I see in your test above it appears you want to test the accounts that are different from 1 by counting them? And the result should expect the account balance should be different from 0?

Best,
Gina

This topic was automatically closed after 166 days. New replies are no longer allowed.