1

Is this a really good idea to use Unit Test Framework for End-To-End testing ? I'm thinking about method annotations to trigger test execution. Since we don't have a lot of control about the execution order and concurrence... Is this a common way to execute E2E tests ?

4 Answers 4

1

Is this a really good idea to use Unit Test Framework for End-To-End testing?

This question can be interpreted in multiple ways.

First, if you are asking "can we use the same tools for e2e testing as unit testing?" then yes you can.

For example, if you are using JavaScript, you can use Mocha/Chia, Jasmine, or Jest for both unit tests and e2e tests. While they are made initially for unit tests, they have been adopted for many testing use cases, including e2e tests. These tools allow you to use them as a test runner, test assertions, test tagging, etc. These libraries are well-documented and have continued support. If you don't use these tools in e2e tests, what are you going to use?

Not all unit test tools are created equal. For example, if using Ruby, I would not use rspec for e2e tests. Mainly due to a lack of documentation and any feature updates that would support e2e tests.

Second, what do you mean by "framework?" Often, people conflate "framework," "library," "tool name," etc. The tools listed above are libraries that you use in order to create a framework of tests and test suites. "Framework" here is more about how you architect your solution, organize it, and tool selections.

In the end, you can use the same tools for both unit and e2e tests -- your implementation will be different.

1

A little more detail would be helpful. What do you mean by end to end tests? Front end tests with Selenium maybe? Or API testing flows touching multiple endpoints and maybe a DB? What programming language are you using?
The short answer is YES, you can and should use a unit testing framework for end2end testing. I'm not sure how you could do it without one, as all IDEs I've worked with use some sort of unit test adapter to discover tests.

0

Yes, I've done exactly that everywhere I've worked for the past 15 years, in Java, C#, and Python. There are some shortcomings using an xUnit style framework for e2e (system) tests, but the pros outweigh the cons.

(I'm assuming here that "framework" in this case means something like TestNG, Unit, Pytest, etc.)

-1

Unit tests :

  • Unit tests are intended to ensure code and methods are working as expected
  • Mostly developers implement unit tests

End to End testing :

  • E2E testing is something we are replicating exactly from start to end just like end user is going to perform in live or production environment
  • This is mostly carried out by QA members with positive and negative scenarios

Your question :

  • NO, we should not
  • Actually those two ways are definitely ensuring the quality somewhere but the objectives are different for both
  • Based on this understanding, we should not use Unit tests as E2E testing

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.