How to tell selenium to use test database? - mysql

I'm using selenium-client to run a few tests, but Selenium seems to be using my development database. How can I point it to use my test DB?

You need to point Selenium to a site that uses the test databases. Selenium talks to your rails, not the database. So, you need to point Selenium to a web app whose config points to your test db, not the dev db.
Hope that helps.

You need to point the Selenium test at an instance of your app that uses the test database.
I wrote a separate deploy task in my capistrano deploy.rb that deploys the application to a testing server, points it at the test db, and loads the selenium-specific fixtures. Selenium treats a deployed app as a black box, so it's up to you to fit all that in to your existing deployment setup.

Related

How to deploy Angular-Flask-MySQL Project on Heroku which Stored in Github repo

I am currently working on a project that uses Angular as frontend framework, Flask as backend framework and MySQL as database.
Furthermore, the developement of the application is completed and the source code is stored in private Github repo.
My next step is to deploy this project on heroku server. After done some research l found that i have to change the database to Clear DB which is the database available in heroku. As a newbie this is my first web app deployment to heroku server.
Is there any online source where i can refer that can fullfiill my requirement or if somebody has done this approach previousely could please list down the steps so i can follow them. Your help will be highly appreciated.
Thanks and best regards.
I had done a project related to angular and flask. I faced the same issue when it comes to app deployment phase.
I deployed the angular app and the flask app in two separate heroku servers. Using this method it is easy for you to do the furthure developments of the application as well.
Following are some reliable sources you can refer,
Deploy flask app to heroku
https://stackabuse.com/deploying-a-flask-application-to-heroku/
Deploy angular app to heroku
https://www.javaguides.net/2020/11/how-to-deploy-angular-application-to-heroku.html?m=1
After deploy both these frameworks separately you can replace your angular api call from https://localhost:5000/api/ to https://yourbackendserver.herokuapp.com/api/

Run API test in CI (Jenkins)

What is the best way to run an API test that was created via the IBM API Connect Test and Monitor ?
I published a test and I would like my CI sever (jenkins or azure devops) to run it?
Many thanks,
Assaf
Great question Assaf. It is currently not possible in the product, however, is on the roadmap and is coming soon.
We will have APIs and Webhooks to help execute tests as part of your CI/CD processes. Meaning, the same tests you generated using the test composer and run in production can be recycled to ensure your deployments are error free.
As well, Jenkins is an industry standard so we will be providing a plugin to help facilitate the API testing processes via GUI. More details to come, will update this space when it does.
Alternatively keep your eye out here: http://ibm.biz/apitest

Setting up a test environment for my EC2 and RDS setup

I have an API which runs on an EC2 instance and connects to a MySQL db.
My goal is to set up a clone of this which I can use as a development platform. Currently everything I do is live.
Ideally I would have up to date data in the test verison of the MySQL database, so maybe a script to auto clone the live version to the test version every day would suffice?
I have a standalone .exe application which calls the API.
What is the typical development work flow here?
I guess I will need a seperate folder on my server for my dev branch. Then I can call the dev url from my standalone application.
So during testing I would change the API url from "/live-api/login.php" to "/test-api/login.php" in my standalone program. I would have the /live-api folder and the /test-api folder hooked up to to the same repo, where the /test-api is always on the dev branch and /live-api is always on master branch?
Thanks!
Your architecture looks good.. You have two folder [ if u are on tomcat two webapps] which come from different branches.
Regarding test db getting updated with production db; it looks tricky. Do you want to have independent RDS for your test environment ? One option is that at night anyway you would have configured to take a snapshot [backup] of your production db.. You can re-create your test RDS db with this new snapshot.. Only drawback would be that any test data created on your test environment will get lost daily..

Selenium Capabilities

I'm drowning in the Selenium documentation. What I've got so far is the ability to record a script in FireFox, export it to the new WebDriver format (JUnit4), open and tweak the test in Eclipse, then run it as a JUnit test in Eclipse.
What I'm wanting next:
to run the same test on multiple browsers
to have a suite of tests run on a remote server at a set interval
receive notification if a test fails
Is this possible using the path I've started down above? It's hard to tell, but I'm not sure that WebDriver is compatible with the RC server. Or, should I just take my suite of JUnit tests and integrate them with something like Cruise Control?
Thank you...
to run the same test on multiple browsers
See: How to run Google Chrome with Selenium RC?
to have a suite of tests run on a remote server at a set interval
This is hard, especially when you are running on headless (terminal only) machine. See this article. But not impossible, read further.
receive notification if a test fails
The typical configuration is to use CI server like Bamboo, take advantage of cargo-maven-plugin to deploy your application and run Selenium tests during integration-test phase. Easier said than done. Since CI server is typically headless, you will need freaks of nature like xvfb, taking a lot of screenshots since you have no idea what is happening during the build when it fails, and so on... But it is possible, we managed to setup such a process in our company and are very happy for it.
Bromine helps you to run on several browsers. Regarding "Scheduling" as already said, maven would help. Try to gather infos about Hudson. It helps a lot in scheduling. It supports selenium too. It helps to send notification also.

build order of post build actions in hudson

I want to run an integration test an to an WAR (in tomcat) using hudson as continous build server.
The post build action to start a script is higher on the list than the deploy action, so I assume it is executed BEFORE the deploying is done.
So how do I deploy and THEN start a script to run my test?
The way I see it, is to write a script to deploy WAR on desired Tomcat server (it should not be complicated) instead of using deploy plugin and then run the script with test.