Ii. Berilgan testlardan test variantlarini shakllantiruvchi dastur yaratish



Download 2,69 Mb.
bet7/7
Sana18.02.2022
Hajmi2,69 Mb.
#455343
1   2   3   4   5   6   7
Bog'liq
2-laboratoriya IOM

Testni shakllantirish oynasi orqali biz test variantlarini shakklantira olamiz (2.3.10-chizma). Bu oynada „Variantlar soni“ sohasida variantlar sonini kiritib, „Variantlar joylashadigan katalog“ sohasidan testni yangi manzilini ko`rsatib, „Tayyorlash“ tugmasi bosilsa, test variantlarini shakllantirib beradi.

2.3.10-chizma. Testni shakllantirish oynasi.
Bu oynada test variantlarini shakllantirish bilan bir qatorda testni generatsiya qilib, testning javob kalitlarini ham shakllantirib beradi.
Biz testni shakllantirayotgan vaqtimizda tanlagan faylimizga murojaat qilmasak, bizning ekranda “ Hamma test fayllari to`g`ri tanlanmagan!! Test fayllari bo`limidan fayllarga e`tibor ber” degan xabar oynasi chiqadi(2.3.11, a- chizma).

a)

b)
2.3.11 – chizma.
Agar foydalanuvchi tanlagan faylining umumiy savollari sonidan “nechta test = 0” bo`lsa, foydalanuvchining dastur oynasida “Hamma test fayllari kerak emasmi? 0 ta ham test bo`lishi mumkinmi? Oka!!!” deb nomlangan xabar ekranga chiqadi(2.3.11, b- chizma).
Dastur uchun talab qilingan fayl talabga javob berish yoki bermasligini tekshirishimiz uchun bizdan ko`pgina vaqtni talab qiladi. Buni oldini olish maqsadida word dasturimizga tekshiruvchi makrosni yozamiz va shu makrosni chaqirib ishlatamiz.
Test shaklini tayyorlash uchun kod qismi

// Test variantini tayyorlash
try
try
W:=CreateOleObject('Word.Application');
//W.visible:=true;
For i:=1 to n do
begin
W.Documents.Open(FileName:=(FindComponent('F'+IntToStr(i))
As TEdit).Text,ReadOnly:=true);
D[i]:=W.ActiveDocument;
DUT[i]:=StrToInt((FindComponent('UT'+IntToStr(i)) As TEdit).Text);
DT[i]:=(FindComponent('T'+IntToStr(i)) As TSpinEdit).Value;
end;
W.Documents.Add;
Kalit:=W.ActiveDocument;
Kalit.PageSetup.Orientation := 1;
Kalit.PageSetup.TopMargin := 28;
Kalit.PageSetup.BottomMargin :=28;
Kalit.PageSetup.LeftMargin :=28;
Kalit.PageSetup.RightMargin := 28;
Kalit.Range.InsertBefore(' Testlarning kalitli javob fayli ');
MyRange:=Kalit.Range(Kalit.Range.End-1,Kalit.Range.End-1);
Kalit.Tables.Add(
Range:=MyRange,
NumRows:=TestCount.Value+1,
NumColumns:=VariantCount.Value+1);
Kalit.Range.InsertAfter(' ');
Kalit.Tables.item(1).Range.Font.Size := 12;
Kalit.Tables.item(1).Range.Font.Name := 'Times New Roman';
Kalit.Tables.item(1).Columns.Item(1).Width:=56;
Kalit.Tables.item(1).AutoFitBehavior(2);
Kalit.Tables.item(1).Borders.Enable:=true;
Kalit.Tables.item(1).Cell(1, 1).Range.Text:='Test \ variant';
For i:=2 to TestCount.Value+1 do
Kalit.Tables.item(1).Cell(i, 1).Range.Text:=IntToStr(i-1);
Kalit.Tables.item(1).Rows.Item(1).Range.Orientation:= wdTextOrientationUpward;
For i:=2 to VariantCount.Value+1 do
begin
//Kalit.Tables.item(1).Cell(1, i).Range.Orientation:= wdTextOrientationUpward;
Kalit.Tables.item(1).Cell(1, i).Range.Text:=IntToStr(i-1);
end;
Kalit.Tables.item(1).Cell(1, 1).Range.Orientation:= wdTextOrientationHorizontal;
if FileExists(Path.Text+'\Kalit.doc') then
DeleteFile(Path.Text+'\Kalit.doc');
Kalit.SaveAs(Path.Text+'\Kalit.doc');
For i:=1 to VariantCount.Value do // varian sonicha
begin
W.Documents.Add;
D2:=W.ActiveDocument;
D2.PageSetup.Orientation := 0;
D2.PageSetup.TopMargin := 28;
D2.PageSetup.BottomMargin :=28;
D2.PageSetup.LeftMargin :=56;
D2.PageSetup.RightMargin := 28;
D2.Range.InsertBefore(' Test variant № '+IntToStr(i));
D2.Range.InsertParagraphAfter;
D2.Range.InsertAfter(' ');
For j:=0 to Memo1.Lines.Count-1 do
begin
D2.Range.InsertParagraphAfter;
D2.Range.InsertAfter(Memo1.Lines[j]);
end;
D2.Range.InsertParagraphAfter;
D2.Range.InsertAfter(' ');
For j:=0 to Memo2.Lines.Count-1 do
begin
D2.Range.InsertParagraphAfter;
D2.Range.InsertAfter(Memo2.Lines[j]);
//D2.Range.ParagraphFormat.Alignment:=1;
end;
For j:=3+Memo1.Lines.Count to D2.Range.Paragraphs.Count do
D2.Paragraphs.Item(j).Range.ParagraphFormat.Alignment:=1;
D2.Range.InsertParagraphAfter;
D2.Range.InsertAfter(' ');
MyRange:=D2.Range(D2.Range.End-1,D2.Range.End-1);
D2.Tables.Add(
Range:=MyRange,
NumRows:=5*TestCount.Value,
NumColumns:=1);
D2.Range.InsertAfter(' ');
D2.Tables.item(1).Range.Font.Size := 12;
D2.Tables.item(1).Range.Font.Name := 'Times New Roman';
D2.Tables.item(1).AutoFitBehavior(2);
D2.Tables.item(1).Borders.Enable:=true;
// Test yozish
Cur:=1; z:=1;
For j:=1 to TestFaylCount.Value do // test faylicha
begin
For x:=1 to DT[j] do // fayldan nechta test olish
begin
b:=RandomRange(1,DUT[j]);
D[j].Activate;
D[j].Tables.item(b).Cell(1, 1).Range.Copy;
D2.Activate;
D2.Tables.item(1).Cell(Cur, 1).Select;
W.Selection.Paste;
W.Selection.Range.InsertBefore( IntToStr(z)+'. ');
D2.Tables.item(1).Cell(Cur, 1).Range.Font.Bold:=true;
s:=Random(23);
For y:=1 to 4 do
begin
D[j].Activate;
D[j].Tables.item(b).Cell(y+1, 1).Range.Copy;
D2.Activate;
D2.Tables.item(1).Cell(Cur+test[s].j[y], 1).Select;
W.Selection.Paste;
W.Selection.Range.InsertBefore(Chr(64+test[s].j[y])+ ') ');
end;
Kalit.Tables.item(1).Cell(z+1, i+1).Range.Text:=Chr(64+test[s].j[1]);
inc(Cur,5);
inc(z);
end;
end;
// Test yozish
D2.Tables.item(1).Range.Font.Size := 12;
D2.Tables.item(1).Range.Font.Name := 'Times New Roman';
D2.Tables.item(1).select;
W.Selection.Rows.ConvertToText(Separator:=wdSeparateByParagraphs,
NestedTables:=True) ;
W.Selection.ParagraphFormat.SpaceBefore := 0;
W.Selection.ParagraphFormat.SpaceBeforeAuto := False;
W.Selection.ParagraphFormat.SpaceAfter := 0;
W.Selection.ParagraphFormat.SpaceAfterAuto := False;
W.Selection.ParagraphFormat.LineSpacingRule := wdLineSpaceSingle;
if FileExists(Path.Text+'\'+IntToStr(i)) then
DeleteFile(Path.Text+'\'+IntToStr(i));
D2.SaveAs(Path.Text+'\'+IntToStr(i));
D2.Close(false);
end;
For j:=1 to TestFaylCount.Value do
D[j].Close(False);
Kalit.Close(true);
except
ShowMessage('Fayl bilan ishlashga xatolik');
end;
finally
W.Quit;
W:=UnAssigned;
end;
ShowMessage(' Test variantlari ko`rsatilgan'+#10+
Path.text+#10+
'Katalogida hosil bo`ldi.Omad!!! ');



Talaba uchun testni generatsiya qilish kodi

// Test faylini talaba uchun generatsiya qilish qismi
if FileExists(F11.Text) then
begin
try
try
W:=CreateOleObject('Word.Application');
//W.visible:=true;
W.Documents.Open(FileName:=F11.Text,ReadOnly:=true);
D:=W.ActiveDocument;
n:=D.Tables.Count;
W.Documents.Add;
D2:=W.ActiveDocument;
D2.PageSetup.Orientation := 0; // 1;
D2.PageSetup.TopMargin := 28;
D2.PageSetup.BottomMargin := 28;
D2.PageSetup.LeftMargin := 56;
D2.PageSetup.RightMargin := 28;
For i:=1 to n do
begin
MyRange:=D2.Range(D2.Range.End-1,D2.Range.End-1);
D2.Tables.Add(Range:=MyRange,NumRows:=5,NumColumns:=1);
D2.Range.InsertAfter(' ');
D2.Tables.item(i).Range.Font.Size := 14;
D2.Tables.item(i).Range.Font.Name := 'Times New Roman';
D2.Tables.item(i).AutoFitBehavior(2);
D2.Tables.item(i).Borders.Enable:=true;
// Satr,Ustun
D.Activate;
D.Tables.item(i).Cell(1, 1).Range.Copy;
D2.Activate;
D2.Tables.item(i).Cell(1, 1).Select;
W.Selection.Paste;
W.Selection.Range.InsertBefore( IntToStr(i)+'. ');
D2.Tables.item(i).Cell(1, 1).Range.Font.Bold:=true;
t:=Random(23);
For j:=1 to 4 do
begin
D.Activate;
D.Tables.item(i).Cell(j+1, 1).Range.Copy;
D2.Activate;
D2.Tables.item(i).Cell(test[t].j[j]+1, 1).Select;
W.Selection.Paste;
W.Selection.Range.InsertBefore(Chr(64+test[t].j[j])+ ') ');
end;
end;
s:=ExtractFilePath(F11.Text);
s1:=ExtractFileExt(F11.Text);
s2:=ExtractFileName(F11.Text);
s2:=Copy(s2,1,Length(s2)-Length(s1));
s:=s+s2+'TalabaUchun'+s1;
if FileExists(s) then
DeleteFile(s);
D2.SaveAs(s);
D2.Close(false);
D.Close(false);
ShowMessage('Berilgan test fayli'+#10+
s+#10+
'Manzilda saqlandi. Omad!!!');
except
ShowMessage('Fayl bilan ishlashga xatolik');
end;
finally
W.Quit;
W:=UnAssigned;
end;
// Test faylini talaba uchun generatsiya qilish qismi

Download 2,69 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish