Ruby中单元测试(Unit Test)方法

Ruby中单元测试(Unit Test)方法
Ruby中单元测试(Unit Test)方法

Ruby中单元测试(Unit Test)方法

Ruby中也提供了单元测试的框架,类似Java中的JUnit,此框架在Ruby中被成为mini test。

我们先看一个例子,这个是我的源代码:

[code lang=”ruby”]

require ‘json’

module PMU_INTERFACE

class IUserLoginReq

def initialize(command_id=nil, user_name=nil, user_password=nil, auth_code=nil, token=nil)

@command_id = command_id

@user_name = user_name

@user_password = user_password

@auth_code = auth_code

@token = token

end

def to_json(*a)

{

"json_class" => self.class,

"data" => self.to_json_hash

}.to_json(*a)

end

def to_json_hash

{:command_id => @command_id, :user_name => @user_name, :user_password =>

@user_password, :auth_code => @auth_code, :token => @token}

end

def self.json_create(json_str)

data = json_str["data"]

new(data["command_id"], data["user_name"], data["user_password"], data["auth_code"], data["token"])

end

attr_accessor :command_id, :user_name, :user_password, :auth_code

end

class IUserLoginResp

def initialize(result=nil, user_name=nil, user_password = nil)

#the login result

@result = result

#the token holding by client

@user_name = user_name

@user_password = user_password

end

def to_json(*a)

{

"json_class" => self.class,

"data" => {:result => @result, :user_name => @user_name, :user_password =>

@user_password}

}.to_json(*a)

end

def self.json_create(json_str)

data = json_str["data"]

new(data["result"], data["user_name"], data["user_password"])

end

attr_accessor :result, :user_password, :user_name

end

end

[/code]

给上面的源代码写测试代码:

[code lang=”ruby”]

require ‘test/unit’

require ‘json’

require_relative ‘../../../source/server/service/pmu_interface/app_interface’

class TestInterface < Test::Unit::TestCase

def test_user_login_req

req = PMU_INTERFACE::IUserLoginReq.new(1, ‘a@b ’, ‘aa’, ‘1234’ , ”)

str = req.to_json

req2 = JSON.parse(str)

assert(str != nil && req2 mand_id == req mand_id)

end

def test_user_login_resp

req = PMU_INTERFACE::IUserLoginResp.new(1, ‘1234’, ‘1234’)

str = req.to_json

req2 = JSON.parse(str)

assert(str != nil && req2.result == req.result)

end

end

[/code]

我们可以看到,测试类继承了Test::Unit::TestCase类,这个类在test/unit库中,test/unit库是Ruby 的系统库,成为mini test。

每个测试方法都是以test开头,这点也与JUnit的规则一致,然后assert也是一致,所以如果你熟悉JUnit,那么做Ruby代码的单元测试就不用学习可以直接写。

还有一点,我们都知道JUnit提供了TestSuite这个类,可以将很多TestCase汇总到一块执行,这个对于持续集成非常有用,因为持续集成需要执行所有的TestCase并输入报告。

要在Ruby中执行TestSuite不是那么简单,因为Ruby内置的库里面没有包含TestSuite,需要额外安装一个第三方的gem(test-unit):

[code lang=”ruby”]

sudo gem install test-unit

[/code]

安装好了之后,就可以使用TestSuite了:

[code lang=”ruby”]

require ‘test/unit/testsuite’

require ‘test/unit/ui/console/testrunner’

require_relative ‘./service/pmu_dao/test_dao’

require_relative ‘./service/pmu_dao/test_db_conn_pool’

require_relative ‘./service/pmu_communication/test_comm8n’

require_relative ‘./service/pmu_service/test_user_service’

require_relative ‘./service/pmu_interface/test_interface’

class PMUTestSuite

def self.suite

suite = Test::Unit::TestSuite.new

suite << TestDBConnPool.suite

suite << TestDAOManager.suite

suite << TestMessageDispatcher.suite

suite << TestMessage.suite

suite << TestUserService.suite

suite << TestInterface.suite

return suite

end

end

Test::Unit::UI::Console::TestRunner.run(PMUTestSuite)

[/code]

我们把每个TestCase都返回一个suite对象:suite << TestInterface.suite,然后增加到suite中,并使用TestRunner执行。 我们要注意的是,mini test中的TestCase类是没有suite方法的(TestInterface.suite),suite方法是通过require 'test/unit/testsuite'之

后,'test/unit/testsuite' 使用了ruby中module 的 mixin特性,给TestCase类增加了suite方法。最后我们看运行结果: [code lang="ruby"] Loaded suite Unnamed TestSuite Started https://www.360docs.net/doc/438843666.html,tin1 tbl_car_private_info tbl_request tbl_task tbl_user_credit tbl_user_info tbl_user_login

tbl_user_private_info .........E Error: test_regist_all_handler(TestMessageDispatcher): ArgumentError: wrong number of arguments (0 for 1)

/Users/maoxuepeng/uproject/utopia-project-

code/main/source/server/service/pmu_communication/comm8n.rb:125:in

`regist_all_handlers' /Users/maoxuepeng/uproject/utopia-project-

code/main/test/service/pmu_communication/test_comm8n.rb:33:in `test_regist_all_handler' .F Failure: test_regist_handler_duplicate(TestMessageDispatcher)

[/Users/maoxuepeng/uproject/utopia-project-

code/main/test/service/pmu_communication/test_comm8n.rb:47]: is not true. ............ Finished in 0.231342 seconds. 26 tests, 25 assertions, 1 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications 92.3077% passed 112.39 tests/s, 108.07 assertions/s [/code] 注意结果中有两个用例,一个是错误一个执行失败。 当然,TestSuite的执行结果是可以美化的,但是还没有研究,有兴趣的同学可以研究后交流一下。

人教版英语必修5 Unit 1 单元测试

Unit1Great scientists SectionⅠWarming Up,Pre-reading,Reading& Comprehending 课后篇巩固提升 一、用括号内所给单词的适当形式填空 1.—We have drawn a (conclude). —What’s it? —It is Tom rather than David who made a serious mistake. 2.I was so (absorb) in the book that I didn’t hear you come in. 3.—Mary,don’t always keep yourself (expose) to the sun.It’s bad for your skin. — Thank you. 4.Do you know how to prove a new idea in (science) research? 5.She found her new job very (challenge) when she came to the new company. 6.It is (announce) that the river has been polluted seriously. 7.Neither the passengers nor the driver (be) to blame. 1

2 8.Seeing the doctor,the little boy said he didn ’t want to (examine). 二、写出画线部分的汉语意思 There was an explosion in a big storehouse.No one had foreseen 1. it and the neighbourhoods 2. near it were affected seriously.Many of the victims 3. were sent to the nearest hospital.And the physicians 4. did all they could to save the injured.However,the accident ’s consequence was severe 5. and some firemen died.We should learn from the explosion and avoid such accidents. 预料,预计 2.居民区 3.受害者 4.医生 5.严重的 三、单句填空 1.I wanted the children to keep (expose) to the language and culture. 2.This medicine will cure him his cough. 3.To our surprise,the man,who was looked down upon by others in the past,is now control of the whole project. 4. conclude,I ’d like to say how much I ’ve enjoyed staying here. 5.His expression suggested that he (be) angry. 6.Nobody is to blame it.

高一英语必修一Unit2单元测试与答案

人教新课标必修一Unit2 English around the world单元同步测试 I. 单项选择 1. ---Are you sure you have ______ all the documents in your list? ---Oh, sorry, I forgot to ______ the one you had sent me. A. included; contain B. listed; include C. listed; be included D. contained; listed 2. She didn’t come to his birthday party just ______what he had said to her the day before. A. because B. because of C. as result of D. thanks for 3. If you want to do international trade successfully, ______ of English is _______. A. good command; a must B. a good command; a need C. a good command; a must D. good command; must 4. Pandas are native ______ China. A. with B. to C. for D. in 5. If you can’t _____ a better plan, we have to carry ou t the present one. A. come along with B. come up with C. come across D. come about for 6. She pretended to be calm but _______she was more than nervous at the time she was being questioned. A. in actual B. actually C. as matter of fact D. in a fact 7. Everybody has ______ to play _____ our environment. A. a part; to protect B. a role; in protecting C. part; in protecting D. a role; to protect 8. When the expression first came into being, people refused to use it but _____ they began to accept it. A. usually B. gradually C. frequently D. quickly 9. You won’t be able to make a wise _____ of a word until you know all the _____ of it. A. use; uses B. usage; usages C. use; usages D. usage; uses 10.My elder sister is _______ studying in Britain and she can speak English quite fluently like a native speaker. A. in the present B. at present C. at the present D. for the present 11. Some minority(少数民族) languages are losing their ______ because of the invasion(入侵) of more popular spoken ones. A. ideas B. natures C. identities D. characters 12. Some animals ______ the tiger, the lion and the wolf are meat-eaters.

人教版八年级下册unit8单元测试题(有答案)

人教版八年级下册unit8单元测试题 一、单项选择(每小题1分,共15分) ( 1. Japan is ________ island country. A. a B. the C. / D. an ( )2. — What is Jim doing? — He is waiting ________ his friends. A. for B. with C. on D. to ( )3. I have never got a letter from him ____________ he left. A. as soon as B. when C. ever since D. while ( )4. — May I borrow your pen? I can’t find mine. — Sorry, mine is broken. Maybe Tom can lend ________ to you. A. his B. this C. it D. ones ( )5. You can use an eraser to clean the ____ on the page. A. bamboo B. mark C. stress D. report ( )6. — ________ have you lived here? — For 20 years. A. How many B. How long C. How much D. How far ( )7. — Would you please ______ yourself to us? — OK. My name is Max and I’m from America. A. introduce B. enjoy C. record D. follow ( )8. — What do you think of the computer? —It’s very important in the ________ world. A. modern B. small C. wild D. ancient ( )9. I used to _______ a cup of coffee in the afternoon, but now I’m used to ______ tea. A. drinking; drink B. drink; drinking C. drink; drink D. drinking; drinking ( )10. —It’s already two o’clock. — We __________ hurry up, or we will miss the train. A. must B. may C. could D. can ( )11. — Is it an exciting book? — Yes, it’s__________ excitements. A. up to B. instead of C. full of D. at least ( )12. It’s very brave of you _______ the child from the big fire. A. save B. saved C. saving D. to save ( )13. — Lisa, have you finished your homework _______? — No, but I will finish it in half an hour.

人教版三年级下册英语Unit3单元测试卷

人教版三年级下册英语Unit3_单元测试卷听力部分 一、听录音.选出你所听到的单词或汉语意思。 ( ) 1. A. 长的 B. 短的;矮的 B. 小的矮的( ) 2. A. B. 老虎( ) 3. A. 长颈鹿 B. 大的( ) 4. A. 高的 B. ( ) 5. A. 瘦的胖的;肥的 二、听录音.选出你所听到的单词。B. UK ( ) 1. A. USA B. small ( ) 2. A. snake B. big ( ) 3. A. bag B. chair ( ) 4. A. pear B. tail ( ) 5. A. tall 三、听录音.选出与你所听到的内容相符的图片。 B. ( ) 1. A. B. ( ) 2. A.

B. ( ) 3. A. 1 / 4 B. ( ) 4. A. ( ) 5. A. B. 四、听录音.选出你所听到的句子的正确答语。re cats. 's a cat. 'B. They( ) 1. A. ItB. It has a long nose. s so tall! ( ) 2. A. It'B. Yes, I am. '( ) 3. A. Its big. B. I like monkeys. 's short. ( ) 4. A. It笔试部分一、选出下列单词的对应词。A. thin (1) tall B. short (2) fat C. big (3) short D. long (4) small 二、选一选。( ) 1. An elephant has big ________. C. ear A. eye B. ears ( ) 2. A duck has ________ legs. C. six A. two B. four ( ) 3. Dad, you ________ tall and I ________ short. C. am; am A. are; are B. are; am ). 滑稽的( ) 4. Look ________ the monkey. It is so funny (C. in A. so B. at

必修五Unit 5单元测试

高中英语必修5 Unit 5 First aid 单元测试题 第一部分:英语知识运用 第一节:单项选择 从A、B、C、D四个选项中,选出适合空白处的最佳选项。 1. Visitors _____ not to touch the exhibits (A). will request (B). request (C). are requesting (D). are requested 2. You should have come to the meeting. What ___ the reason for your absence. (A). is (B). will be (C). was (D). would be 3. Turn on the television or open a magazine and you ______ advertisements showing happy families. (A). will often see (B). often see (C). are often seeing (D). have often seen 4. A this time tomorrow ____ over the Atlantic. (A). we’re going to fly (B). we’ll be flying (C). we’ll fly (D). we’re to fly 5. It has been decided that all the students ____ stay in he classrooms even on Saturday evening in case they go to the Internet bars. (A). must (B). can (C). need (D). shall 6. He’s going to ____, ____ to take his own measure. (A)tailor’s, not Smith’s (B)the tailor’s, not the Smiths’ (C)the tailors’, not the Smiths’(D)tailors’, not Smiths’ 7. “What about the weather here in winter?” “It’s ____ warmer than in the north of this country.” (A)fairly (B)rather (C)quite (D)very 8. _______________ the school when the bell rang. (A) Hardly did I reach (B) I hardly reached (C) Hardly had I reached (D) I hardly had 9. If you _________ here a minute, the manager will be here in a moment. (A) will wait (B) wait (C) are going to wait (D) are waiting 10. Does it matter ______ it rains tomorrow? (A) if (B) that (C) whether (D) as 11. _________ and __________, they ran out of the room. (A) Excited, happily (B) Exciting, happy (C) Excitedly, happily (D) Exciting. happily 12. During the days ________, he worked as a servant. (A) following (B) followed (C) that followed (D) to follow 13. Tony is going camping with ______ boys. (A) little two other (B) two little other

人教版七年级下册英语unit2单元测试卷(含答案)

七年级下册英语Unit2单元测试卷 一.单项选择。(20分) ( )1. — How about taking __________ walk now — Sounds great. A. a B. / C. an D. the ( )2. — When do you go to bed —Usually_______ nine o’clock. A. on B. in C. at D. to ( )3. —What’s t he time —__________ six o’clock. A. Its B. It’s C. This is D. They are ( )4. — How many _________ does the baby have — Two. So he only drinks some milk. A. books B. chairs C. groups D. teeth ( )5. — Is Mr. Zhang very popular (受欢迎的) with his students — Yes, his classes are ____ interesting. A. always B. never C. sometimes D. seldom ( ) vegetable soup I have more ( ) quickly and has no breakfast to work. dressed dress dress dressed ( ) is so hot should and have a rest(休息). take a shower a shower a shower shower ( ) goes to school every is late for class. ;never ;never ;always ;usually ( )10.—When do you ,Frank —. ;On weekends ;On weekend ;On weekends ;On weekend ( )11. The little boy __________ every morning. A. brushes his tooth B. brushes his teeth C. brush his tooth D. brush his teeth ( )12. — ___________ John often __________ school —No, he isn’t. A. Does; late for B. Is; late to C. Is; late for D. Does; late to

unit8单元测试卷

Test for Unit 8 (时间:120分钟,满分:120分) 听力部分(25分) Ⅰ.听句子,选择恰当的应答语。(每小题1分,共5分) ( )1.A.One cup. B.Two. C.Three bananas. ( )2.A.Yes, I do. B.Yes, I did. C.No, thanks.I’m full. ( )3.A.Yes, I could. B.Sure. C.Yes, please. ( )4.A.Thank you. B.That’s right. C.Good idea. ( )5.A.Only a little. B.Only a few. C.Few. Ⅱ.听短对话,选择正确的图片。(每小题1分,共5分) ( )6.What does the man like best? ( )7.What will they eat? ( )8.What does Helen usually eat for breakfast every day? ( )9.What don’t they have? ( )10.What did Frank eat just now? Ⅲ.听长对话,选择正确答案。(每小题1分,共5分) 听第一段对话,回答第11、12小题。 ( )11.What does the woman want to learn to make? A.Bread. B.Tomato salad. C.Turkey sandwiches. ( )12.What does the woman do at last? A.Add some tomato slices. B.Put another slice of bread on top. C.Add a teaspoon of relish. 听第二段对话,回答第13—15小题。 ( )13.What are they talking about? A.How to make a milk shake. B.How to make sandwiches. C.How to make fruit salad.

Unit3_单元测试卷

Unit3 单元测试卷 听力部分 一、听音,将下列图片按A-E排序。 ( ) ( ) ( ) ( ) ( ) 二、听音,选择你所听到的选项。 ( ) 1. A. cool B. cold C. cloudy ( ) 2. A. snowy B. sunny C. windy ( ) 3. A. warm B. weather C. wear ( ) 4. A. weather report B. world weather C. play football ( ) 5. A. kite B. swim C. fly 三、听音,给句子选择合适的答语,按A-E排序。 ( ) Yes, it is. ( ) It’s rainy in Beijing. ( ) It’s sunny today. ( ) Yes. Here you are. ( ) OK. 四、听音,打钩。 read book watch TV fly kites play football make a snowman sunny rainy

笔试部分 一、选出不同类的一项。 ( ) 1. A. cold B. cool C. outside ( ) 2. A. sunny B. world C. windy ( ) 3. A. weather B. warm C. hot ( ) 4. A. London B. cloudy C. Moscow ( ) 5. A. snowy B. rainy C. love 二、用所给词的适当形式填空。 1. It’s cool and ________ (rain) in Beijing. 2. Can you fly ________ (you) kite? 3. Be ________ (care)! It’s very hot. 4. What’s the weather ________ (like) in Sydney? 5. It’s ________ (snow) outside now. 三、火眼金睛,选一选。 ( ) 1. It ________ hot. A. are B. am C. is ( ) 2. Here is the ________ report. A. sunny B. windy C. weather ( ) 3. ---Can you fly a kite? ---________ A. Yes, you can. B. No, you can’t. C. No, I can’t. ( ) 4. ---Is it cold in Beijing? ---________ A. Yes, it is. B. Yes, it does. C. No, t hey aren’t. ( ) 5. What’s the weather like ________ Beijing? A. at B. in C. on

人教版高中英语必修五Unit 1 Great scientists单元检测

英语人教版必修5 Unit 1Great scientists单元检测 Ⅰ.单项填空 从A、B、C、D四个选项中,选出可以填入空白处的最佳选项。 1.(2011江苏高考)—Are you still mad at her? —Not really,but I can't ______ that her remarks hurt me. A.deny B.refuse C.reject D.decline 2.(2011辽宁高考)The exam results will be ______ on Friday afternoon. A.put down B.put off C.put up D.put away 3.—In this day and age,women can have children and jobs as well. —I can't agree more.It's great to have the two ______. A.linked B.related C.connected D.combined 4.Your house is always so neat—how do you ______ it with three children? A.manage B.serve C.adapt D.construct 5.No matter how much money you have,it cannot ______ a healthy body. A.compare B.fit C.defeat D.match 6.(2012重庆高考)We're having a meeting in half an hour.The decision ______ at the meeting will influence the future of our company. A.to be made B.being made C.made D.having been made 7.(2012福建高考)Pressed from his parents,and ______ that he has wasted too much time,the boy is determined to stop playing video games. A.realizing B.realized C.to realize D.being realized 8.He always brings me a pretty gift ______ he comes to visit me. A.by the time B.sometimes C.every time D.at times 9.The doctor suggested that the girl ______ in order to lose weight. A.must not eat less B.ought not to eat less C.had better not eat less D.not eat less 10.(2012福建毕业班质检,28)The world is full of wonders,______ we open our eyes to see them. A.if only B.as if C.even if D.only if 11.(2012河北普通高考模拟)—How did she lose so much weight as expected? —______ eating less,she jogged for several miles every day. A.In spite of B.In addition to C.Instead of D.Thanks to 12.(2012山东潍坊一模)This restaurant,______ by an old couple,has an inviting,homelike atmosphere that many restaurants lack. A.owning B.having owned C.owned D.to own 13.What do you think of the suggestion ______ by the expert? A.put forward B.put up with C.put off D.put out

英语UNIT2单元测试2

一、单选 1. ________ is the second day of the week. 2. --what do you have on mondays?-- i ______ chinese and english on mondays. a.have b.am c.has d.is a.at b.on c.for d.by 4. _________.where is our science teacher? a.sorry b.hello c.excuse me d.hi 5. we often ________ tv on saturday evening. a.look b.watch c.see d.say 6. it’s time ________ do homework. a.at b.for c.to d.on 7. what does your mother do ____ weekends? a.about b.on c.at d.to 8. i can play football ________ my father. a.and b.to c.for d.with 二、情境交际 1. 询问今天是星期几,应该说:______________ a.what day is it today? b.what day it is today? 2. 询问周二的课程安排时,应该说:_____________ a.what do you do on tuesday? b.what do you have on tuesday? 3. 介绍完自己后,想了解一下对方,应该说:_____________

Unit3__Weather单元测试卷及答案

Unit3 Weather单元测试卷 一、判断下列每组单词画线部分的读音是否相同,相同的打“√”,不同的打“×”。(5分) ( )1. car card ( )2. hot cold ( )3. tall ball ( )4. bird girl ( )5. warm arm 二、按要求完成下列各题。(5分) 1. hot (对应词)____________ 2. can not (缩写形式)____________ 3. sun (形容词)____________ 4. cool (对应词)____________ 5. snow (形容词)____________ 三、选词填空。(10分) 1. __________ I have some soup? 2. It’s _________. You can’t go outside. 3. Be___________! 4. It’s sunny. Can you_______ a kite with me? 5. —What’s the_________ like today?—It’s warm. 四、单项选择。(14分) ( )1. —________ the weather_________? —I t’s snowy. A. What; like B. What’s; like C. How; like ( )2. It’s warm________ sunny today. A. or B. / C. and ( )3. Is it cool ________Kunming? A. in B. at C. on ( )4. Here _______ the weather report. A. at B. are C. is ( )5. Can I go home? —___________ A. Yes, you can’t. B. No, you can’t. C. No, you can. ()6、It______ hot? A.is B.am C.are ()7、What’s the matter you? A. for B. to C. with ()8、Where are my _________? A. shoes B. they C. those ()9、It’s 10:00. I ________ go to bed. A. must B. have to C. have ()10、This is the ________ report. A. P.E. B. weather C. music ()11、________ about New York? A. What’s B. How C. Where ()12、What is the weather like _________Beijing. A. on B. at C. in ()13、Can I wear my skirt today ? A. Yes,you can. B. No,it isn’t . C. Put on you skirt. ()14、Is it hot today? A. Yes, it isn’t. B. No, it is. C. Yes, it is 1.( ) 2. ( ) 3. ( ) 4.( ) 5.( ) 六、按要求完成下列句子。(30分) 1. is, this, report, weather, the, (.) (连词成句) 2. Can you swim outside? (作肯定回答)

人教版高中英语必修五unit1课文重点练习详解

Unit 1 GREAT SCIENTISTS JOHN SNOW DEFEATS “KING CHOLERA”John Snow was a famous doctor in London — so expert, indeed, that he attended Queen Victoria as her personal physician. But he became inspired when he thought about helping ordinary people (who were) exposed to cholera. This was the deadly disease of its

day. Neither its cause nor its cure was understood. So many thousands of terrified people died every time there was an outbreak. John Snow wanted to face the challenge and solve this problem. He knew that cholera would never be controlled until its cause was found. (expose:1暴露be exposed to all kinds of weather.经受

风吹雨打。Expose sb to danger 使某人面临危险。 A student who has been exposed to English for some 6 years.接触英语达 六年左右的学生。 2.揭露。Expose a politician’s lies. He has been exposed as a liar.他说谎的行为被揭穿。) He became interested in two theories(that possibly explained how cholera killed people). The first

人教版七年级下册英语unit2单元测试试题(含答案)

Unit 2 单元过关检测(100分) 时间:45分钟 Ⅰ.词汇。(10分) (A)用所给单词的适当形式填空:(5分) 1. Lily brushes her (tooth)after getting up every morning. 2. That’s a (fun)time for breakfast. 3. My father often does some (exercise). 4. Tom sometimes (eat)some meat and vegetables. 5. We must have fruit and vegetables (keep)healthy. (B)根据句意和首字母提示写单词。(5分) 6. Mary likes eating ice-cream. It t good. 7. In the evening, Tony e watches TV or plays games. 8. Eating q isn’t a good habit for us. 9. I think playing basketball is a h sport for students. 10. He s goes to school at 7:30, but he is never late. Ⅱ. 选择填空。(10分) -thirty. () 11. ---What’s the time? ---It’s _______ three A. of B. around C. at () 12. I usually go to bed _______ ten o’clock. A. in B. at C. on () 13. Please write and tell me _______ your school lady. A. about B. for C. with () 14. We often do _______ homework at home. A. we B. us C. our () 15. _______ interesting movie it is! A. What B. How C. What an () 16. Please come _______ here. Don’t go _______ now. A. to; home B. /; to home C. /; home () 17. I usually watch TV _______ Saturday evenings.

初三上Unit8单元测试题及答案

Unit 8 一、单项填空。 从每小题A、B、C、D中选出一个能填入句中空白处的最佳答案。 ()1. —Why not come and join us in the game? —_______ .But I must go to meet Mr. Smith at the airport. A. I'd like to B. Let's go C. Y es,please D. It's a pleasure ()2. John is much better than I_______. A. to playing chess B. for playing chess C. at playing chess D. in playing chess ()3. He has _______ daughter_______ Mary. A. a eight years old, name B. an eight-years-old, named C. an eight-year-old, named D. a eight-year-old, naming ()4. The classroom is very dirty today. It is hard _______. A. cleaning B. to clean it C. to leaning D. to clean ()5. I don’t think you are right. So I can’t _______ you. A. agree with B. agree to C. agree on D. agree ()6. —I’m going to buy a birthday cake. —_______? —No. My friend’s daughter. A. Is it your son B. Is it for someone in your family C. When are going to buy it D. Is it your birthday ()7. Life _______ a pig isn’t always perfect. A. of B. with C. from D. to ()8. After school he didn’t go home. _______ he went to the Internet café. A. But B. While C. Instead D. Instead of ()9. In Japan the same gift may _______ to someone else. A. give back B. give away C. be given back D. be given away ()10. —Is that your eraser? —No, ______ is red. It must be ________. A. my , somebody else B. mine , somebody else’s C. mine , someone else D. my , someone else’s ()11. In China, People like giving big gifts to _______. A. someone else B. else someone

相关文档
最新文档