0:00:09 | okay a viral i'm gonna talk about some work often recently so for testing web |
---|
0:00:16 | services or all the testing the client codes which we use and i still to |
---|
0:00:20 | web services |
---|
0:00:23 | so what is web service because of examples to go contacts people you to i |
---|
0:00:29 | guess a web |
---|
0:00:30 | open street maps a few also downloading map files facebook scruffy ple basically any hasty |
---|
0:00:37 | gpus H T S service which |
---|
0:00:40 | can be and is used by the desktop |
---|
0:00:43 | i don't specifically limiting my work eight H T P and he cts because it |
---|
0:00:47 | makes everything a whole is |
---|
0:00:50 | and doesn't really |
---|
0:00:52 | restrictive anyway because |
---|
0:00:54 | pretty much every web service uses one of the same because you don't get problems |
---|
0:00:58 | of a levels |
---|
0:00:59 | in that sense |
---|
0:01:02 | so |
---|
0:01:04 | when you think about testing web services you go to the big question you can |
---|
0:01:07 | ones there is what you want to test |
---|
0:01:10 | you want to test your point code you wanna make sure isn't crash but you |
---|
0:01:14 | want tested the point conforms to the current behaviour of the server or some cost |
---|
0:01:19 | behaviour which is what you actually programmed against |
---|
0:01:22 | the user would say you want current behaviour because that's what i actually want to |
---|
0:01:25 | use but that's quite tricky to do because that means you gonna test online which |
---|
0:01:31 | gives you of those problems with connectivity and race conditions and slowness and all sorts |
---|
0:01:39 | so we wanna catch regressions in point carried but we also wanna catch that isn't |
---|
0:01:44 | it changes in the save as behaviour which require changes in your point codes the |
---|
0:01:49 | new features or |
---|
0:01:51 | whatever the changed online |
---|
0:01:56 | so |
---|
0:01:58 | you can do it two ways you can do offline testing or online testing and |
---|
0:02:02 | one talking about here is offline testing developing working on |
---|
0:02:08 | the bait basic idea of offline testing is that you somehow record how the server |
---|
0:02:12 | hey and then test against are offline not using that work not touching the curve |
---|
0:02:18 | javier the server so it's reliable because younger always network problem you've eliminated the web |
---|
0:02:24 | service and all the network infrastructure in between from your system on the test |
---|
0:02:29 | so massively cut down a good place |
---|
0:02:32 | but it's not what users care about because the web service changes your point code |
---|
0:02:36 | isn't getting tested against like situation |
---|
0:02:40 | you can also |
---|
0:02:42 | test against the carburetor the server |
---|
0:02:45 | which is as i said what we use just care about but it requires a |
---|
0:02:47 | network connections the instantly eliminates any kind of continuous integration or testing on a seven |
---|
0:02:53 | provided by know because it's just so unreliable it's hassles that so and network admins |
---|
0:02:59 | don't like it |
---|
0:03:00 | it's unreliable |
---|
0:03:02 | and that's a problem that's it's and me a lot in the G data which |
---|
0:03:06 | is more based this work on where basically every time a run make check it |
---|
0:03:11 | failed and that would be D to |
---|
0:03:13 | transient network problems or subtle changes in the so that it behaviour that S how |
---|
0:03:19 | to compensated for but the point was actually point |
---|
0:03:25 | another thing about online testing is that web services change so if you're gonna do |
---|
0:03:30 | offline testing you need to |
---|
0:03:32 | be able to change your tests and update them so they represent the lexus takes |
---|
0:03:37 | of a server and that was easy because you don't wanna spend time doing that |
---|
0:03:40 | you got much better things today |
---|
0:03:44 | finally what services are distributed systems which is a problem it's an lots |
---|
0:03:50 | which means that roger circuit a good wasn't example later just have one server which |
---|
0:03:55 | has a leo contacts on they have hundreds and as it turns out if you |
---|
0:03:59 | say for example instead to contact in your address book and it says another one |
---|
0:04:04 | and then query your address book one you contacts |
---|
0:04:07 | often they don't here for ten twenty seconds |
---|
0:04:12 | which means that your test code has to get to sleep the channel twenty seconds |
---|
0:04:15 | and that's it means your tests take ages to run which is horrible because you |
---|
0:04:20 | can get most of the way three make check and then it'll five and you |
---|
0:04:24 | gotta start again |
---|
0:04:26 | so that's one of the major reasons why online testing bad |
---|
0:04:33 | there are also other problems with |
---|
0:04:37 | online testing do you to things like resource limits and |
---|
0:04:42 | the fact that you have to use not a natural online account so testing against |
---|
0:04:46 | cable services they limit you to say a thousand press today so if you wanna |
---|
0:04:50 | run make checking continuous integration you gonna hit against that limits and also new tests |
---|
0:04:55 | are gonna fail for us today and there's nothing you can do about that |
---|
0:04:58 | similarly if you wanna run test from multiple locations so one developer in europe and |
---|
0:05:03 | one america and they both whatever make czech good people is gonna say well that |
---|
0:05:09 | test account is be involved in two places at once |
---|
0:05:12 | i'm gonna look at out and then again make czech stops working |
---|
0:05:17 | so it would be working on is |
---|
0:05:20 | maybe oscillation for offline testing |
---|
0:05:25 | where you record H T P messages between client and server you save into a |
---|
0:05:29 | file you commit that get you then run only a test again start but periodically |
---|
0:05:34 | you can manually check and compare the trace files against the carburetor was of the |
---|
0:05:40 | and check other the same or if the difference then you know what's changed so |
---|
0:05:44 | you cannot take your code in your tests to match but it means that's for |
---|
0:05:48 | most the time this of one testing can be done in continuous integration it can |
---|
0:05:52 | be a lot faster sleep and you don't have always problems with synchronization or resource |
---|
0:06:00 | limits |
---|
0:06:04 | so there are various other existing solutions i mean it's a pretty simple idea but |
---|
0:06:09 | most of the large over only so the first three they basically exactly what describes |
---|
0:06:16 | why more is a separate process which makes in the paying to set up |
---|
0:06:21 | rest drive a is rest only which eliminates a huge number one services but |
---|
0:06:25 | also means you can test if you don't know number one services and betamax children |
---|
0:06:30 | as well |
---|
0:06:31 | question they will smoke an e-mail of all the open source projects which is similar |
---|
0:06:36 | sort of things with the cost and hardware but obviously not exceeding gonna translate and |
---|
0:06:40 | fractions |
---|
0:06:43 | so the approach of taking would look at it is to a broad enough is |
---|
0:06:48 | a revelation |
---|
0:06:50 | we directly apply requests to a local in precisely but other and then from that |
---|
0:06:56 | replay the trace and compare every incoming H T you request with the trains and |
---|
0:07:01 | then reply with respondent race well |
---|
0:07:04 | if they don't if they you can make the press that match what's in that |
---|
0:07:07 | race while then you get never your tests fail and everyone stopping one happy |
---|
0:07:14 | alternatively you can not a variety S and the test will go straight to the |
---|
0:07:18 | online server and then you can compare the responses not with the choice while and |
---|
0:07:23 | see if the servers changed compared to last time you save the choices |
---|
0:07:29 | so you this operates at H T P level using them so you which is |
---|
0:07:34 | simple things a lot this transpose can be human readable and |
---|
0:07:37 | does debug able |
---|
0:07:40 | it means you can do |
---|
0:07:44 | simulation of H T P errors like timeouts and for a forcible server iras every |
---|
0:07:49 | five hundreds things like that with relative ease you not filling around of the lower |
---|
0:07:54 | levels of T C P I P which would just be too much for fire |
---|
0:07:56 | it gives you extra power but for the most part it's not needed for more |
---|
0:08:00 | web services "'cause" there will be H T to you know like |
---|
0:08:04 | unlike a one or more |
---|
0:08:07 | the server that's your testing against the offline server is kept in process so you |
---|
0:08:13 | don't have process synchronisation signal tests and this mock server so some for things a |
---|
0:08:19 | lot |
---|
0:08:23 | and because it's overriding the N S it requires minimal code changes to your point |
---|
0:08:28 | so of the solutions that people |
---|
0:08:32 | suggest would be to take your clients and split it out into interface isn't and |
---|
0:08:36 | reimplement interfaces with an online petition offline version and that becomes fourty complicated cost many |
---|
0:08:42 | changes and is |
---|
0:08:44 | a real fast |
---|
0:08:47 | so by writing the N S you basically have to change a client to |
---|
0:08:52 | specimen H T people to use because it'll be a wide range one so you'd |
---|
0:08:56 | have to run three but you can easily switch between online and offline just by |
---|
0:09:01 | turning off the gas reservation |
---|
0:09:04 | so diagrams everyone much diagrams |
---|
0:09:07 | so this is have things currently all you've got your system on the test which |
---|
0:09:11 | is your point code running on the desktop and you've got on one server which |
---|
0:09:14 | are testing against you got always this page T V transactions going between them |
---|
0:09:20 | so |
---|
0:09:21 | now introduce a lots of the choice while and you locally say C T V |
---|
0:09:26 | transactions to that race while so we still doing online stuff but once when you |
---|
0:09:31 | first set of tests you save more to try as well |
---|
0:09:35 | and commitment to get |
---|
0:09:38 | you can and the your testing case that race while eliminate on one server everything |
---|
0:09:42 | goes remote server by redirecting guess the choice well get right into that and of |
---|
0:09:48 | course happy |
---|
0:09:50 | you can also compare your choice well against the online so the point again switching |
---|
0:09:55 | to doing the transactions online but also reading interest well i'm comparing now same time |
---|
0:10:01 | so you can see what's changed you do not manually once a month or whatever |
---|
0:10:05 | one of if you like it or something develop to take trough and you continuous |
---|
0:10:09 | integration so |
---|
0:10:12 | so he's a example |
---|
0:10:15 | of how we change your unit test so the test it is here |
---|
0:10:20 | whatever it is something sensation he request gets response pulses it doesn't ounce bottle of |
---|
0:10:26 | and what you have is |
---|
0:10:29 | beginning dedicated and dedicated around each unit test |
---|
0:10:33 | which was a trace the stock price |
---|
0:10:36 | it's cool since your code somewhat susceptible to use because you gonna use this high |
---|
0:10:42 | range pull so you don't wanna use rate don't just use port eighty |
---|
0:10:47 | and then you also tell the D N S resolver which your is to have |
---|
0:10:53 | a right so if you testing able services you know growing people dot com and |
---|
0:10:57 | some supplements that when you set up to run results you'll be back seven |
---|
0:11:02 | this also means that any requests that you don't expect to other domains however unlikely |
---|
0:11:08 | that they would gets a D N S translation arrow and so you can catch |
---|
0:11:12 | buttons that way |
---|
0:11:15 | probably not gonna happen |
---|
0:11:17 | and you can wrap as a lot than us and macros or something so you |
---|
0:11:21 | basically just a one line before and after each unit test |
---|
0:11:25 | there is some code i'm not showing here which you and you log handler which |
---|
0:11:30 | will be htk mess in haiti messages like tricks while but that's just a few |
---|
0:11:36 | lines didn't feel |
---|
0:11:40 | so i've implemented this village a data which is the project a hard on about |
---|
0:11:45 | most |
---|
0:11:47 | so make czech was over ten minutes because of all these sleeps to wait for |
---|
0:11:51 | the synchronisation in the street a system on the server side |
---|
0:11:55 | you can emanate willows and make czech negatives down two hundred and thirty seven seconds |
---|
0:12:00 | done with a quick run of point make check |
---|
0:12:03 | you can cover interesting about the same after implementing this it's likely increased because i |
---|
0:12:08 | did a few tests for every conditions which i can nowadays so i can now |
---|
0:12:12 | simulates and this of the giving you an access denied error or saying your accounts |
---|
0:12:17 | been compromised |
---|
0:12:20 | so you can add test cases for those which you wouldn't be able to do |
---|
0:12:22 | for |
---|
0:12:24 | because you can't manipulate so state |
---|
0:12:27 | but generally it's been useful |
---|
0:12:31 | i haven't |
---|
0:12:32 | applied the store the libraries yes but there's a whole later than can be modified |
---|
0:12:36 | this that and help also there's the facebook graphic the only as a go a |
---|
0:12:42 | do you able a no one counts |
---|
0:12:46 | do the network as it could possibly use it as well this |
---|
0:12:49 | you know as a lot of stuff that could have it and it was is |
---|
0:12:52 | become a bit more stable |
---|
0:12:55 | but there are some problems so |
---|
0:12:59 | in your traditional unit tests that's a you have a set of function the unit |
---|
0:13:03 | test function attend on function and you can reuse the set of content and functions |
---|
0:13:07 | for multiple unit tests because they do common things like you have won the ads |
---|
0:13:12 | the contact and that at a functional remove contacts and then you have there is |
---|
0:13:16 | unit tests do different things with a new contract |
---|
0:13:21 | unfortunately this means that's |
---|
0:13:23 | if you have a choice while |
---|
0:13:26 | per unit test |
---|
0:13:28 | and they have point these in them |
---|
0:13:30 | not identify your contact for example |
---|
0:13:34 | the only these are generated by the server will differ from indication of set up |
---|
0:13:38 | to different invocations that so |
---|
0:13:40 | and there's a bit of written in the trace files which means that your unit |
---|
0:13:44 | tests will need |
---|
0:13:46 | well that response for each unit test believe modifying afterwards to make a list id |
---|
0:13:51 | is the same |
---|
0:13:52 | which is something i haven't worked out how to fix yet |
---|
0:13:56 | probably isn't too hard |
---|
0:13:59 | similarly you go from the time stamps if you have H T P response which |
---|
0:14:03 | includes time stamps well in the body or in that is a nice it up |
---|
0:14:07 | to choice while and then you run test against it next month it's on some |
---|
0:14:11 | so gonna get acetate and i could cause problems in some cases |
---|
0:14:16 | again i think is work around |
---|
0:14:19 | and then also if you may detest against cancellation the messages the current way of |
---|
0:14:23 | will be noticed that race problems knots |
---|
0:14:26 | particularly great |
---|
0:14:29 | and needs a bit of work |
---|
0:14:33 | so currently this work is being done in the G data and i haven't yet |
---|
0:14:37 | split up into separate project i'm in the process of doing that and it'll be |
---|
0:14:41 | committed to get doris shortly |
---|
0:14:44 | sorry please on other people can start using it |
---|
0:14:49 | there's a lot of potential running standard error responses way like return an error five |
---|
0:14:54 | hundred or narrow for a for or whatever and it be good to implements |
---|
0:15:00 | some kind of easy support for that in they |
---|
0:15:02 | the testing code so that every point code uses it doesn't have to read that |
---|
0:15:07 | and goals need to what of the libraries |
---|
0:15:11 | so that was |
---|
0:15:14 | representation of it and also construct a bit of a discussion about this because it's |
---|
0:15:18 | an area when i'm can improve a lot basically most of a networking code websites |
---|
0:15:22 | is good is |
---|
0:15:24 | effectively untested that lines so |
---|
0:15:27 | this is a like a brief implementation of my ideas and i'm sure there's a |
---|
0:15:32 | lot of stuff can be added an improved |
---|
0:15:34 | and i'd welcome any suggestions people have |
---|
0:15:37 | well questions |
---|
0:15:51 | i do you deal with the be catching a bit encrypted connections |
---|
0:15:58 | as in H T us encryption |
---|
0:16:01 | catching |
---|
0:16:04 | well if i understood well the moat server cash the request |
---|
0:16:09 | yes that catches the H T P requests so actually yes |
---|
0:16:16 | packaging of that this is not don't within the tries postal remote server has its |
---|
0:16:22 | own dummy certificates and K which you have to commit to get and then you |
---|
0:16:28 | also have to model for your point code to say no don't districts of course |
---|
0:16:33 | in checks we so there are being work that for that kind of like so |
---|
0:16:39 | you've done some work in yes i mean would you know to use it H |
---|
0:16:43 | T yes and also working point obviously you modifications district see a checks would be |
---|
0:16:49 | the okay like and should never be used in production but |
---|
0:16:52 | this is a few lines |
---|
0:17:07 | so i wanted to ask you to will who are offering some kind of staging |
---|
0:17:12 | services like to just it on production servers or |
---|
0:17:18 | is there something else |
---|
0:17:21 | so i don't know about anything else but giggle don't have testing service they have |
---|
0:17:26 | an online api playground which is web only when you can talk in requests on |
---|
0:17:31 | a web page and test them out but that's mostly documentation thing so what the |
---|
0:17:37 | test cases that i have run against productions others and that's what you run into |
---|
0:17:40 | these problems with and request limits and |
---|
0:17:43 | accounting not so |
---|
0:17:45 | and it would be nice if they provided |
---|
0:17:48 | playground sins a staging service |
---|
0:17:51 | like that |
---|
0:18:01 | no questions okay so because will be upon victorious hopefully in the next day at |
---|
0:18:08 | the moment it's in the G data in the tests directory and wants to take |
---|
0:18:13 | a look and or controlled we have to is about me |
---|
0:18:17 | thoughts you have so thank you much |
---|
0:18:19 | thank you |
---|