Thursday, 23 November 2017

ffmpeg animated gif one-liner

Commandline to make a quick demo easy and to just by default make it autoplay in for example facebook. sorry if you have seen this all before, but this blog is my braindump.

.\bin\ffmpeg.exe -i .\cbc.wmv -b:v 50k -r 2 -y -ss 2.000 -t 11.000 .\cbc_T.gif

-r 2 = 2 frames per second
-b:v 50k = 50kbits bitrate need to add the k, and need to be specific that the rate is a video rate with :v
The bitrate did not have a significant impact on file size.
-ss = start from
-t = duration to convert

Hope this helps the next person. note, there are loads of similar blog posts, but had to capture some of the more salient parameters, because ffmpeg command parser often just ignores a parameter it cannot parse, so beware typos.

Joining clips

To join 2 clips -is a bit problematic in windows because the ffmpeg separator | character has a special meaning in dos, so I found the easiest was to create a response file.

file y:\20171122_173829.mp4
file y:\20171122_170515.mp4
file y:\20171122_173829.mp4

Save this text as files.txt (note that this file expects the path separator "/" not "\" , for some reason the [drive:\] protocol is fine with a "\", but paths must use a "/".

and then use the concat argument

C:\Tools\ffmpeg\bin>ffmpeg.exe -f concat -i .\files.txt -an -c copy -y .\20171122_173829all.mp4

notice use of -an to kill the audio track off

Add Audio

Lastly, to add and use an audio track using -shortest
ffmpeg.exe -i .\20171122_173829all.mp4 -i elevatormusak.mp3 -c copy -shortest -y .\20171122_173829final.mp4

Wednesday, 1 November 2017

ffmpeg file compress

I really easy trick to shrinking files by reducing them from 30fps to 10fps

..\bin\ffmpeg.exe -i .\largerfile.mp4 -r 10 -y .\destination.mp4

I'm getting about 20x reduction in filesize - and resulting vidoe is very "skippy", but fine for desktop shared recordings that don't animate.

Monday, 23 October 2017

Which Test Cases to Automate

I've decided to blog a bit about my day-job, well, my career and passion really. Software testing, but the kind that makes sense, automated regression. But first and foremost a warning, when a computer validates some software, that's not called testing at all, it's called checking. See here for a bit more on why.

With that out of the way, lets move on. Automating anything is expensive, automating a test case is not a silver bullet, because a computer cannot validate things like a UI layout making sense, or even an API function call rejecting a parameter value either for that matter. Sure we get frameworks that test for UI changes in web pages and in WPF and other forms based applications. But when controls move and we all know that a UI changes cosmetically very often, that incurs maintenance cost. Tools exist to reduce that cost , but they only do so in very specific ways.

Likewise for Automation or Test tooling against public APIs. "Apps" on the internet are the main case here, but this also applies to locally consumed API's not just the web, and all the new kinds of web services available today, its a crazy farm almost. Just about everyone has a web service these days, or at least an API; and since that surface is the really high value customer interface, it's the best place to do testing and best place to automate at the same time. A test script using an API cannot just validate assertions in your test spec, without some skill in writing that script to be maintainable or scale well. Without going into design stasis, arguments about specs, or test frameworks, let's be really Agile; do the parts of the job we can get most early value from first and foremost.

But which test cases do you convert? From that huge batch of analysis done when you looked at this from a manual test perspective last year. The boss wants you to automate all of the things. Now.
Based on my inputs and the way we started doing this, one of the grads came up with using Excel. I'll link the sheet below, but first I'll explain what all of the columns mean.
Test ID A unique test identifier (optional) A pretty basic thing, but very much dependant on your test management tool choices.
Name Description of the test - short is better
Easy to script How easy is it to write a test script for this case. Be pragmatic in your estimate. Give it a 5 if it's trivial , but if it's impossible to, give a 0 (zero)
Manual time cost The amount of interactive human being time it takes to run this test manually, if the test suite has got lots of setup required, count that time separately, only count time for this test in hours needed. If tests tend to take a few seconds to run manually, adjust this accordingly so that quick tests get a 1 and painfully long to run tests get a 5. Also do not count waiting time, if for a file to copy that perhaps takes 30 minutes, that time is not counted.
Data/Table driven Is this a test that really benefits from boundary testing and has multiple simple input output classes that take time to cover most of the meaningful combinations fully if done manually. If Yes, give it a 5 , not really, give it a 1.
Cost of Failure Will it hurt the product and crate risk if this test fails. If Yes, give it a 5 , not really, give it a 1.
Likely to regress Is this case likely to catch useful regressions caused by code or integration changes? If Yes, give it a 5 , not really, give it a 1.
ReUse Is automating this a test now, going to help you write other tests by providing a library of helper functions that will grow your coverage eventually? If Yes, give it a 5 , not really, give it a 1.
Priority Does this verify anything a manual tester would have to do anyway before most other testing commences. Do testers test this functionality very often? In other words, is this a test that has to run early in the cycle. If Yes, give it a 5 , not really, give it a 1.
Some things to notice here, I use a very low resolution scale of 1-5. Higher granularity in the question scales actually end up take much longer on average for a user to guess at a value, and let's face it, this is a game of educated guesses or estimates anyway. It's best if 2 people do this process together. Some of the columns only benefit from entering a 1 or a 5 and nothing in between, some of the columns even allow a 0. As a tester, I'd not expect you not to try entering a 0 in cases where it makes sense to, for these, the sheet will give still you a good answer out. So you can just add these all up, or give each question priorities. In another posting, I'll share the spreadsheet template and the weightings as well.

This only works well after you have obviously captured half a dozen cases and looked at them in relation. Remember, don't spend too much time on each row, this is a planning activity only.

Wednesday, 27 September 2017

Lean Coffee Meetup

A "Lean Coffee" under the Meetup banner is an agile interpretation of a networking event for software testing professionals in our case. Because time is precious the monthly morning coffee is a very intense and quick-fire format. Final moments close with a summary where everyone states one thing they learned. Results here may vary, and I made notes only for our table which was half of the 12 or 13 odd who attended. A voted Q&A format with 8 minutes per topic presented the following ideas.

  • How to develop new testers. Getting up to speed suggestions. 
(Test mentoring, timeboxing, domain learning and process learning discussed)
  • Is the programming language used to write automated tests important?
(pros and cons for Java,Ruby,Python and importance of test fixtures were covered. As well as scale-ability and performance)
  • In a one man test team, how do you plan?
(3 amigos, division of responsibility, assesment of the security risk, assesment of scale risk)
  • How to get others to see your side of a test failure?
(describe the risk to business and cost clearly)
  • Biggest challenge in test 
(horror stories ensued)

In the meet I mentioned a link to this clip to share with people

If you want to join up with us, please follow this link and sign up.

Thursday, 17 August 2017

Maxim DS onewire temp sensor home automation

Trying to create a hybrid Raspberry pi homebaked cheapie.

1. hookup to the solar heating water system (see prior blog article)
2. Add a power consumption sensor to monitor electricity use.
3. Add water temp and room temp sensors using 1wire dallas sensors

Starting from the bottom.

A cheaper display here

  • Next up is the power. I have a standalone wireless monitor, which is technically on loan, want to try share this unit along, and get myself a pickup coil and wireless that is easier to hack. (wired or wireless does not matter really.) My intention is to buy a Maplin unit which they sell for £40, and then hack either the wireless (433 MHz) or the internet API it has .
More info on the Efergy , harvested from the forums is this kind blog link detailing some of the protocols.

Wednesday, 10 May 2017

Storage closet 5c

passcode: 1721
5C notice board: orsyr ii
5C exit code: 2954

Tuesday, 2 May 2017

How to repair stuff

No literally, things break, fact of life. Fixing stuff is the only way to keep 2 very useful things in life. Junk out of the landfill and cash in your pocket.

So 2 tips:

  1. Sugru substitute:
  2. Superglue (UK only)

The Hafix postage costs are high, so order the 20 gms bottle.

I went over to the local landfill this weekend, with 2 bootloads of cleared out garden rubble and excess bin waste. It feels a real shame that we throw so much stuff into landfills. Even the stuff that is sorted at the recycling centre is still really inefficient. So I feel sad about all of the waste, but there you have it.

Friday, 3 March 2017

Weighing a LPG gas bottle

Okay , so we have 47kg bottles - now, lp gas cannot be measured using pressure

So I'm going to use 2 load cells in  bridge to get the mass of a bottle. Each cell is good for 50KB, but in a bridge, and add 2 pairs (4 cells) it really gives you 100Kg, since weight is distributed across the cells - you just have to average (add) them.

Vbus and 485

The other part besides a load of sensors to gather and log data for is the water heating system. It's Resol VBUS based. 

A Circuit diagram
RESOL Circuit Diagram v3

A full converter with usb is available here: price unknown. I sent off a query to get a price anyway.

One thing is that the solar controller unit is obviously not isolated from the power supply, something you will want to do for any equipment which is connected (at least by proximity) to water pipes, and to your roof in event of god ever getting unhappy with you and sending a bolt down. Nearby strikes also cause problems for piping anyway. So with a bit of searching, it appears that the bus supplies 35 ma (or 65 on newer devices) constant current. They appear to use this to drive a LCD remote display in one instance I believe, but not sure. anyways, it got me thinking that an opto isolator (which needs about 10mA) will work here if we power our converter from the line current. The LM339 uses almost no juice nor does our circuit. And the 5.5V signal sent on the master drops to around 4.5V due to our rectifier. which will still run our converter circuit, but may require a transistor on the Raspberry Pi side to clean up if needed, although I'm going to try without a transistor first.

Aha - just read the spec doc, the end of the doc contains a diagram supporting my assertion that you can use an opto coupled circuit to get galvanic isolation powered off of the line. Using a 5.1v zener; just add an extra rectifier diode to pump the supply which is fed through a 330 ohm resistor to prevent the power supply killing the data line, and smoothed off into a 470uF cap. (100nf ripple ceramic needed as usual.)