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.

Nested test structures?

See original GitHub issue

Trying to play around with CodeceptJS, having never actually used Mocha or anything similar before. Mocha’s docs seem to indicate that you can set up nested tests using describe() and it(). It looks like Codecept’s Feature() and Scenario() are an alternative method to setting up Mocha’s Suites. Is there a similar way to set up nested tests using CodeceptJS? For example, something vaguely like:

Feature('Test1');

Before((I) => { // or Background
  I.amOnPage('/');
});

Scenario('Interact with the login page ', (I) => {
  Feature("Test 1 - Part 1");

  Scenario("Filling in login form shows consent banner", () => {
    I.see('Username');
    I.dontSee("You are accessing");
    I.fillField("httpd_username", "user1");
    I.fillField("httpd_password", "pw1");
    I.see("You are accessing");
  });

  Feature("Test 1 - Part 2");

  Scenario('Can log in successfully', () => {
    I.see('Username');
    I.fillField("httpd_username", "user1");
    I.fillField("httpd_password", "pw1");
    I.click('Agree and Log In');
    I.wait(1);
    I.dontSee("Username");
  });
});

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
DavertMikcommented, Jan 23, 2017

I think this can be closed as all helpers have restart: false option which can be used to reuse browser session

0reactions
Nighthawk14commented, Jul 22, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit 5 Nested Tests: Grouping Related Tests Together
JUnit 5 nested tests give us a way to construct a hierarchy in the tests. We can organize the tests in a logical...
Read more >
Testing nested structures with AssertJ - DEV Community ‍ ‍
In this post I would like to describe a nice pattern that helps testing nested structures with AssertJ. Let's imagin there is a...
Read more >
JUnit 5 Nested Class: @Nested Tutorial With Examples
Nested class as the name suggests is the class that is placed inside another class and is arranged in a hierarchical structure. We...
Read more >
JUnit 5 Nested Tests - Mkyong.com
3.1 For big class, we should consider the @Nested tests, all tests in a single test class (in a hierarchical structure), and the...
Read more >
CSC 212 Notes - Nested Decision Structures
The nesting of decision structures allows a program to sequentially determine the current state of a problem component under investigation. One might find...
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