0

I'm using spec-flow and selenium to do some automation testing.

I'm testing a hierarchy component which may contain parent / child nodes.

My test is to ensure that the hierarchy displays parent and child nodes but of course in the real system this will depend on the database being present and populated with the correct data is there a way to mock the database in automated test is it bad idea?

How do I ensure that my tests are robust?

This feels like it's the wrong thing to do but given my problem I can't see any other alternatives but to ensure that my environment is always reset before each automation test run.

1 Answer 1

2

As I understand from the details you provided, there's a component that is in charge of receiving data and displaying it as nodes (which is the component you want to test) and another component in charge of connecting to the database and getting the data.

In order to test the displaying component, it's perfectly valid (and possible - see some tutorials based on your programming language) to mock the DB component and it will even make your test more robust as there are fewer reasons for failures that are not related to the test (DB down etc...).

Basically, mocking should be used to make your tests test one thing and fake dependencies, so your case fits.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.