mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
449 stars 108 forks source link

User authentication feature #46

Open CHukioo opened 5 years ago

CHukioo commented 5 years ago

I really like OpenTest so far. I have request tough, is there any chance to add user control over the UI? For example: user that can create sessions and see results, user that can only preview the results... etc.

adrianth commented 5 years ago

I know there is a need for a way to let users view test execution results without the ability to start and cancel test sessions, basically to have a "read only" view of the current and past test session execution results. If this is what you need, we are planning to implement a feature to allow for this. Please note that this is most probably going to be implemented differently than through a user authentication feature, because proper authentication can only be implemented over HTTPS, and most people don't want to go though the trouble of setting up a domain for the OpenTest server and buying (and maintaining) a certificate. The way we're thinking to do this initially is to have a configuration parameter for the OpenTest server that instructs the server to start in read-only mode. This way, you can run two instances of the server: a read-write one for the test automation engineers, DevOps people, etc., and a read-only one for managers and anyone that needs to keep up to date with test execution results. The read-only instance will run on a different port, which you can expose that to the "public". The read-write instance will run on a port that is not accessible from outside. The OpenTest server is a really lightweight application, so running two instances is not going to cause any performance or resource depletion issues. Does that sound like something that would solve your problem?

CHukioo commented 5 years ago

Yes, that's perfect. If i setup the Jenkins and OpenTest on the same machine, i think i can trigger the tests from Jenkins.

adrianth commented 5 years ago

Yes, you can trigger a test session using the web API or, even better, using the command line. The command line option was added in the latest version and is still not documented, but here's the gist of it:

opentest session create --template dir1/Template1 --wait --out junit.xml

The --wait option tells the command to wait until the test session completes before returning, which is what you want when you run from Jenkins. The --out option specifies the name of the file where the test execution results are going to be generated. The results file is using the JUnit XML format, which is supported in Jenkins and other CI tools.

galegor commented 5 years ago

@adrianth Hi, is it possible for you to estimate when this feature could be included? I would add the option of not sharing logs in this read-only instance. In many cases, SQL queries or other sensitive data can be found there, DB users or even more goodies, if passwords are not encoded.

adrianth commented 5 years ago

@galegor Yes, logs can definitely contain sensitive information, so non-privileged users shouldn't have access to them. My estimation is that it'll take about three weeks for this feature to be implemented, but that also depends on what dependencies and hurdles will surface during development that I am not aware of.

galegor commented 5 years ago

Hey @adrianth I was wondering if the above feature is planned to be released any soon?

galegor commented 5 years ago

Noticed that some code is already there to support this feature like this constant in ui.ts const isReadOnlyRouter = options.readOnly || false;

adrianth commented 5 years ago

Yes, the code is already there, and the feature will be available with the next release. I was planning to include more things in the next release, that's why I haven't published it yet, but let me know if you need this feature soon, and I can publish a new release at the end of this week.

galegor commented 5 years ago

We need this feature as soon as possible and it would be excellent if you could release it this week

adrianth commented 5 years ago

The feature is now ready to use in the latest version of OpenTest (1.1.2). The implementation will not require you to run two instances of the server, but simply set the readOnlyPort parameter in the server.yaml file. For example:

readOnlyPort: 3005

A read-only view of the OpenTest web UI will be made available on the port specified.