Skip to main content

What are login states?

Login states in Spur allow you to manage authentication across your tests efficiently. Spur provides flexible options to handle authentication states across your tests, enabling you to start tests from authenticated states or save login states for reuse. Configure these settings in the test side peek.
Overview of Login States

Overview of Login States

Before and after login states

Without login states, every test that requires authentication must include its own login steps, adding redundancy and slowing down execution. With login states, you save a login session once and reuse it across tests, so they skip straight to the actual workflow.
Test with login steps included

Before: Login steps are repeated in every test

Test skipping login steps

After: Test skips login and starts from the authenticated state

How to configure login states

1

Navigate to the test side peek

During test creation in the test side peek, open Login State & Browser Cookies. It has two options: Use a saved session and Save this session.
Navigate to the test side peek
2

Choose your login state configuration

Select the appropriate login state option based on your testing needs.
1

Use a saved session

Begin this test using the login state from another test. This allows tests to skip login steps and start directly from an authenticated state, reducing execution time and improving test efficiency.You can also use Scenario Tables to organize and select login tests directly, streamlining authentication management across multiple test configurations.How it works:
Start from Logged-in State
  1. Check Use a saved session
  2. Select a login test under Login test
  3. Your test will begin with the authentication state from the selected test
  • Tests that require an authenticated user
  • Avoiding redundant login steps
  • Maintaining consistent test state
2

Save this session

Make this test’s login state available for other tests to use. Ideal for creating dedicated login tests that other tests can reference.
Login states are saved at the end of test execution and can be used by other tests that select this test as their login state source.
How it works:
Save Login State for Other Tests
  1. Check Save this session
  2. Complete your login test
  3. Other tests can now select this test as their login state source
  • Creating reusable login tests
  • Making authentication states available across test suites
  • Reducing test execution time

Parallel test execution with multiple accounts

When running tests in parallel, it’s recommended to use different accounts for different test suites to prevent state interference. This ensures:
  • Tests can run simultaneously without affecting each other’s states
  • Each test suite has its own isolated authentication context
  • Changes made in one test suite won’t impact the others
  • You can maintain predictable test behavior in parallel execution

Best practices

Create Dedicated Login Tests
  • Make separate tests for different user roles
  • Keep login tests focused and minimal
  • Use clear naming conventions (e.g., “Admin Login”, “Customer Login”)
State Management
  • Save login states from tests that perform authentication
  • Reuse login states to reduce test execution time
  • Consider test dependencies when managing states
Security Considerations
  • Use environment variables for credentials
  • Regularly update saved login states
  • Clear authentication data in teardown tests when needed
Contact support to configure authentication for custom setups.