Member 13784265 Ответов: 1

Какой тип утверждения следует использовать при проверке, выполняется ли эта конкретная функция при нажатии этой клавиши?


so here I've been trying to do this small manual testing task . i have created a class of teacher and it has a function that creates a student record and rewrites it in its specific position in the file (using linked list). i have a separate header file that has all functions in it and .cpp file separate too. but when i try to test a simple function that either on pressing ch = 1 does function create_node runs or not ? i have no idea which assert to use ? any one can figure out what the issue or is this something wrong with my testing code ? and 'm very very beginner to this testing thing . if anyone could help me with tutorial for manual testing that would be appreciated too .

Что я уже пробовал:

#include "stdafx.h"
#include "CppUnitTest.h"
#include "Header.h"
#include <string>

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace UnitTest1
{		
	TEST_CLASS(UnitTest1)
	{
	public:

		TEST_METHOD(TestMethod1)
		{
			string T_name;
			string subject;
			int age;
			int Class_teacher;
			int ch=0;
			teacher T;
			Assert::IsTrue(ch = 1, T.create_node(T_name, subject, Class_teacher, age));

		};
	};
}

KarstenK

У вас есть ошибка в сравнении. Вам нужно "==" в Assert::IsTrue(ch == 1,