Setting up easy to use testing environment

Hi,

What kind of testing environment could/should we use? We have a live website to which we often make changes on a copy of the site. Sometimes big, sometimes small changes. Then we test it and if it's OK, we copy the changes to the live site. All handwork. No tracking of changes or whatsoever. Also, in the meanwhile sometimes change are also made to the live site directly, especially small ones.

I would think there are better tools to do something like this nowadays.

What do you advise?
Thanks
peps03Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
Using Subversion (versioning) make trackable changes, when approved, commit the changes to the public/production side.
When live environment changes are made, the update from the test environment will remove those changes eventually.

No changes on live, without prior changes on the test.  Without change management.   something small but significant can be omitted.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
peps03Author Commented:
Would you use a tool or a website's service for that?
Steve BinkCommented:
I prefer git to Subversion, but same idea as arnold.  Set up your actual live site as the master branch, and create branches for development and testing.  Do all your work development, and push to testing for QA.  Once you're convinced, merge into master.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Guy LidbetterCommented:
Hi there peps,

I would really really recommend Team Foundation Server (TFS 2012) or the like for managing this type of thing.
All changes are tracked, version history maintained etc...

Its worth a look...
Steve BinkCommented:
You would use Subversion or git, most likely on your own servers.  

If you don't have issues with a public development model, you could host your code on github.com.
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Hi,

Are you looking commercial product or just something that you can use to deploy from dev/uat to prod environment?

Regards
Ray PaseurCommented:
You can use GitHub.  If you want to keep your work private, you can pay a small fee.  You can also use BitBucket, and IIRC a single repository is free.  You can use Git to track your changes on either system.

For testing you might choose PHPUnit and Mockery for the server side, and Jasmine for the front-end.  These systems are set up for unit testing and once your environment has been properly configured, you can run all of your unit tests with a single statement on the command line:

$ phpunit

The output will immediately* tell you if your tests worked or failed.  It can also generate code coverage reports to show what you're testing and what is missed.

* a matter of seconds.
F PCommented:
PHPUnit testing would probably really help you out immensely to make sure things are going to run as expected prior to uploading your code, doesn't track changes, and will provide proof it works ahead of time. Basically exactly what Ray just said.
peps03Author Commented:
Thanks all. Are the services you mentioned easy to setup? Are we talking hours or days?

And can you work with multiple people on a project at the same time?

And what is you accidentally work on the same file at the same time?

Where do you do your coding when using these tools? Locally? Online in the tool's interface?

@ray:
For testing you might choose PHPUnit and Mockery for the server side, and Jasmine for the front-end.
 
Wouldn't using 1 tool be easier and more clear? I would think you make your changes you need in the test environment, then when they're good just push them live. Isn't their 1 tool that could do all?

These systems are set up for unit testing and once your environment has been properly configured, you can run all of your unit tests with a single statement on the command line:
$ phpunit
Unit testing? What is a unit in this matter?

Would you always have to do your checks with the command line? How will you see the results? In the browser?
Ray PaseurCommented:
Wow, this is an area of current research that would take a college semester to answer all the questions but I'll try to cover some of it.  Mostly you just have to start work in these areas to see what is going on.  You can find a lot of slideshare and youtube presentations that will help you get up-to-speed.

Are the services you mentioned easy to setup? Are we talking hours or days?
Git is very easy to set up.  Repositories are generally a matter of minutes for an experienced developer, and GitHub or Atlassian (BitBucket) have online guidance to help you.

And can you work with multiple people on a project at the same time?
Yes, that is the whole point of version control.  But you have to have some kind of management controls, too.  If you refactor someone else's code while they are writing unit tests, you'll create a problem in the team, so make sure there is good human communication as well as good dev tools.

And what if you accidentally work on the same file at the same time?
You either accept the changes, or roll back to the last stable version.  Git uses "branches" to manage these things.  A week or so studying how it works and experimenting with its process will get you on firm footing.  There are entire books written about how to use Git, but there are also web sites that teach the process.  Atlassian has good online tutorials.

Where do you do your coding when using these tools? Locally? Online in the tool's interface?
You code locally.  A general workflow might look like this:

1. git pull origin develop
2. git branch my_dev_code
3. write unit tests
4. write code to satisfy unit tests
5. phpunit
6. run unit tests, and if needed go back to 3 or 4
7. when all unit tests pass and the code and tests in my_dev_branch are ready...
8. git push my_dev_code
9. code review with peers...
10. git push origin develop

(PHPUnit and Mockery) Wouldn't using 1 tool be easier and more clear?
No, these tools work together.  Trust me, you do not want to write your own mocks!

... make your changes you need in the test environment, then when they're good just push them live. Isn't their 1 tool that could do all?
There is not one tool, but there are "hooks" in these processes.  For example, you can prevent code from being pushed to the origin develop repository if it does not pass unit testing.  That's useful, but it presumes quality in the unit tests.  This is a very broad area, and worthy of careful study.  You're not going to get a succinct "1 tool" answer because there are too many moving parts in the workflow, and every application dev team works a little differently.

Unit testing? What is a unit in this matter?
"Unit testing" is a term of art in computer science.  Start your learning here:
https://en.wikipedia.org/wiki/Unit_testing

Would you always have to do your checks with the command line? How will you see the results? In the browser?
Get familiar with PHPUnit, then revisit that question.  Once you have it installed and you use it once or twice, you will have a whole new appreciation of software quality.

It goes without saying but I'll say it any way... These modern methods are applicable to object-oriented design principles and OO code.  If you have old PHP code that uses procedural techniques, you have a whole different set of problems, and you basically have two choices.  Either refactor the code to bring it into the 21st century or write your own test suites.  Refactoring will be easier and have more enduring value.

If you're new to object-oriented design, this can help you find some good learning resources.
http://www.experts-exchange.com/articles/18329/SOLID-Design-in-PHP-Applications.html

If you're thinking of sticking with procedural programming and want to understand what you need to do to write your own test suites, delve into this article.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7830-A-Quick-Tour-of-Test-Driven-Development.html

It's a lot to take in, but it will make your programming skills marketable at the highest levels.
F PCommented:
Essentially, unit testing is writing the functions you want to use, passing values and variables to the function arguments to test what output you're expecting to get, and documenting it.

If I wrote a piece of code which relies on a method from my class, or 3, I want to make sure that the methods and functions work, and that the resultant from it is what I expect. So, unit testing is where you make XML documents which you can use to create faux variables and run the phpunit tests against for validation and testing. Now that you have validation, it's also documented that the code within it is working, but won't track your changes between validations.
peps03Author Commented:
Thanks all for your useful information and taking the time to explain.

I think we might start using Git. I'll dive into it a bit more and try it out. Seem like what we need :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.