It All Starts With The Gherkin
Enter CucumberJS
"Cucumberizing" Your Tests
BDD Without "Cucumberizing"
- Write test method names that describe behavior
- Use test class names that provide context: a useful trick is to prefix it with "when". Here's a Java example that might illustrate this a bit better:
public class WhenUpdatingMyBirthDate { @Test public void should_be_able_to_edit_birth_date_on_profile_page ... }
expect(obtainableStatuses).to.have.length(3).and.to.incluge('Gold');
Without Cucumber, the answer to, "How do I do automated testing in AngularJS?" is pretty straightforward. Google has built two amazing good tools Karma and Protractor which are test runners that execute unit tests and ui/e2e tests, respectively.
With Cucumber
Scenario
|
Web / e2e
Step Definitions
Scenario
|
Unit Test
Step Definitions
Start with this:
Then change it to this: