0

The problem I have it's that I don't know what is the best way to test multiple scenarios that test different permissions on files by one or two users. Those tests are automated by Selenium. And my main concern is time usage by running tests.

Currently, we have tests implemented like this:

- One user. One file. Read permission
- One user. One file. Edit permission
- One user. One file. Add file/s permission
- One user. One file. Print permission
- One user. One file. Download permission

- One user. More files. Read permission
- One user. More files. Edit permission
- One user. More files. Add file/s permission
- One user. More files. Print permission
- One user. More files. Download permission

- More users. One file. Read permission.
- More users. One file. Edit permission.
- More users. One file. Add file/s permission.
- More users. One file. Print permission.
- More users. One file. Download permission.

- More users. More files. Read permission.
- More users. More files. Edit permission.
- More users. More files. Add file/s permission.
- More users. More files. Print permission.
- More users. More files. Download permission.

Is this a good way to test every permission by itself? Or is it better to test by one user and one file and then join all permissions and test them all together?

Tried to find some documentation or some article but didn't find any useful information.

1
  • I don't know if you've got this covered elsewhere or is maybe even out-of-scope for your assignment, but where are scenarios for users with mixed permissions? Adding / removing permissions to users while logged in? Users trying to access things without permissions?
    – Prome
    Jan 30, 2023 at 14:51

2 Answers 2

0

It depends on your goals and constraints. If you are looking to optimise testing time, you might consider combining tests where possible. For example, you could have one test case that tests multiple permissions for one user and one file.

However, this approach might make it harder to understand what exactly went wrong if a test fails. If you separate out each permission into its own test, it will be easier to pinpoint which permission specifically is causing the failure.

Ultimately, it is a trade-off between test speed and test granularity/debugging ease. It is up to you to determine which approach is best for your situation, based on the specific requirements and constraints of your project.

A better solution to test multiple scenarios in this scenario could be using parameterised tests. In parameterised tests, you can run the same test case multiple times with different parameters. This way you can reduce the number of test cases required to test all the scenarios.

In your example, you can create a single test case that tests the permission and pass the parameters such as user(s), file(s), and permission type. You can then define the parameters in a data-driven approach using a data provider or test data from a file.

This way you can reduce the number of test cases from 15 to a single test case and still cover all the scenarios. This can improve test execution time and make the tests more manageable.

Additionally, you can use a test framework that supports parameterised tests and data-driven testing, such as JUnit or TestNG, to implement this solution.

1
  • Thank you for your answer. :) I just wanted to know if we are doing big mistake by testing with so many scenarios. Yes the debugging it's easier. Small tests and mistake can easily be found. But it's so time consuming. This test in selenium take 20min to execute. But luckily we found the way that we can run test parallel so time consume will not be problem (at least i think so (: ) And yes we reuse a lot of same functions when testing. The only thing that changes are input parameters. So in some kind the way we do test like you described.
    – MeGeT
    Jan 31, 2023 at 7:07
-1

I don't know any best practice for this, but my pov is: rearrange every group of tests so that they resemble an e2e test, that will be easier because in case of success, you spend less time on preparing the test data.

example

  • One user. One file. Add file/s permission -> Read permission -> Edit permission -> Print permission -> Download permission

hope i understood your question correctly.

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.