thoughtbot / laptop

A shell script to set up a macOS laptop for web and mobile development.
https://thoughtbot.com
MIT License
8.5k stars 1.91k forks source link

Testing suggestions? #133

Closed kevinSuttle closed 11 years ago

kevinSuttle commented 11 years ago

You know, for as long as I've been in this whole dotfile movement, I've wondered how you go about testing these scripts. Setting up a VM is time-consuming, and a huge hassle for OSX. You can also set up a separate account on OSX, but most things are installed globally and not per-user, which makes it tough to test using a "clean" system every time.

Do you have any suggestions or tips? Is there a way to dry run? Thanks guys!

mike-burns commented 11 years ago

https://github.com/mike-burns/rcm/pull/6 - here is a pull request where we are experimenting with testing. But this is just for dotfiles.

For larger things---such as the laptop script---it's likely to be more instructive to bring up a separate jail or jail-like thing (VM, chroot, etc). This whole process could be automated, leading to a test suite.

We do not currently support a dry-run in the laptop script (though it would have been rather trivial to implement with the successfully sh function), and a dry-run for the dotfiles script is in the works.

pbrisbin commented 11 years ago

Testing via VMs as automated by Vagrant would be straight-forward, and I think most robust. The main blocker though, is that you can't (legally) make an OSX VM.

kevinSuttle commented 11 years ago

@pbrisbin THANK YOU. Finally someone cleared up what the issue was for OSX. What a pain.

drapergeek commented 11 years ago

@pbrisbin If you use vmware fusion on OS X you can legally make an OS X VM.

You can also use vagrant to power vmware fusion. Only good for those on OS X...

pbrisbin commented 11 years ago

Nice @drapergeek, I did not know that. Vagrant can now manage vmware boxes, so perhaps that's an option.

kevinSuttle commented 11 years ago

@drapergeek Very cool. I'm new to Vagrant, so I'd love to see how you approach it.

pbrisbin commented 11 years ago

FYI: https://github.com/thoughtbot/laptop/tree/pb-testing

I expect to open a PR from that branch on Friday.

kevinSuttle commented 11 years ago

Awesome! I'm excited to see it.

kevinSuttle commented 11 years ago

So, I think the TESTING.md requires more detail. I'm still not sure what I should be doing, if OSX is tested, etc.

pbrisbin commented 11 years ago

I'll try to clarify it tomorrow before I open the PR -- but to answer your specific questions:

To run the test: Install VirtualBox/Vagrant and execute ./test/runner.sh. That's it.

OSX is not tested (because I'm on linux and therefore can't run an OSX VM). Someone on a mac will have to contribute a Vagrantfile.mac.

kevinSuttle commented 11 years ago

Thanks Pat!

kevinSuttle commented 11 years ago

I meant to tell you, running this works great for testing Linux distros.

Anecdotally, for Mac, I tried an experiment with my own dotfile repo, where I gave users a choice. In jumping back and forth, I ended up doing a lot of testing of uninstall and re-install. If you think about it, as long as you have your files in git, possibly in branches, you're totally free to try scripts and blow the whole thing up and start over. There's no fear really. It's rather liberating once you mentally arrive there.